feat: TU19 (Dec 2014) Features & Content (#155)

* try to resolve merge conflict

* feat: TU19 (Dec 2014) Features & Content (#32)

* December 2014 files

* Working release build

* Fix compilation issues

* Add sound to Windows64Media

* Add DLC content and force Tutorial DLC

* Revert "Add DLC content and force Tutorial DLC"

This reverts commit 97a4399472.

* Disable broken light packing

* Disable breakpoint during DLC texture map load

Allows DLC loading but the DLC textures are still broken

* Fix post build not working

* ...

* fix vs2022 build

* fix cmake build

---------

Co-authored-by: Loki <lokirautio@gmail.com>
This commit is contained in:
daoge
2026-03-03 03:04:10 +08:00
committed by GitHub
parent 84c31a2331
commit b3feddfef3
2069 changed files with 264842 additions and 139522 deletions

View File

@@ -0,0 +1,37 @@
#include "stdafx.h"
#include "..\Minecraft.World\net.minecraft.core.h"
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
#include "..\Minecraft.World\net.minecraft.world.level.h"
#include "AbstractProjectileDispenseBehavior.h"
shared_ptr<ItemInstance> AbstractProjectileDispenseBehavior::execute(BlockSource *source, shared_ptr<ItemInstance> dispensed)
{
Level *world = source->getWorld();
Position position = DispenserTile::getDispensePosition(source);
FacingEnum *facing = DispenserTile::getFacing(source->getData());
shared_ptr<Projectile> arrow = getProjectile(world, position);
arrow->shoot(facing->getStepX(), facing->getStepY() + .1f, facing->getStepZ(), getPower(), getUncertainty());
world->addEntity(arrow);
dispensed->remove(1);
return dispensed;
}
void AbstractProjectileDispenseBehavior::playSound(BlockSource *source)
{
source->getWorld()->levelEvent(LevelEvent::SOUND_LAUNCH, source->getBlockX(), source->getBlockY(), source->getBlockZ(), 0);
}
float AbstractProjectileDispenseBehavior::getUncertainty()
{
return 6;
}
float AbstractProjectileDispenseBehavior::getPower()
{
return 1.1f;
}

View File

@@ -0,0 +1,17 @@
#pragma once
#include "..\Minecraft.World\DefaultDispenseItemBehavior.h"
class Projectile;
class AbstractProjectileDispenseBehavior : public DefaultDispenseItemBehavior
{
public:
shared_ptr<ItemInstance> execute(BlockSource *source, shared_ptr<ItemInstance> dispensed);
protected:
virtual void playSound(BlockSource *source);
virtual shared_ptr<Projectile> getProjectile(Level *world, Position *position) = 0;
virtual float getUncertainty();
virtual float getPower();
};

View File

@@ -187,30 +187,34 @@ wstring AbstractTexturePack::getAnimationString(const wstring &textureName, cons
wstring animationDefinitionFile = textureName + L".txt";
bool requiresFallback = !hasFile(L"\\" + textureName + L".png", false);
InputStream *fileStream = getResource(L"\\" + path + animationDefinitionFile, requiresFallback);
//Minecraft::getInstance()->getLogger().info("Found animation info for: " + animationDefinitionFile);
#ifndef _CONTENT_PACKAGE
wprintf(L"Found animation info for: %ls\n", animationDefinitionFile.c_str() );
#endif
InputStreamReader isr(fileStream);
BufferedReader br(&isr);
wstring result = L"";
wstring line = br.readLine();
while (!line.empty())
InputStream *fileStream = getResource(L"\\" + path + animationDefinitionFile, requiresFallback);
if(fileStream)
{
line = trimString(line);
if (line.length() > 0)
//Minecraft::getInstance()->getLogger().info("Found animation info for: " + animationDefinitionFile);
#ifndef _CONTENT_PACKAGE
app.DebugPrintf("Found animation info for: %ls\n", animationDefinitionFile.c_str() );
#endif
InputStreamReader isr(fileStream);
BufferedReader br(&isr);
wstring line = br.readLine();
while (!line.empty())
{
result.append(L",");
result.append(line);
line = trimString(line);
if (line.length() > 0)
{
result.append(L",");
result.append(line);
}
line = br.readLine();
}
line = br.readLine();
delete fileStream;
}
delete fileStream;
return result;
}
@@ -253,7 +257,14 @@ void AbstractTexturePack::loadColourTable()
void AbstractTexturePack::loadDefaultColourTable()
{
// Load the file
#ifdef __PS3__
// need to check if it's a BD build, so pass in the name
File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":NULL).append(L"res/colours.col"));
#else
File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col"));
#endif
if(coloursFile.exists())
{

View File

@@ -3,12 +3,14 @@
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
#include "..\Minecraft.World\Mth.h"
ResourceLocation ArrowRenderer::ARROW_LOCATION = ResourceLocation(TN_ITEM_ARROWS);
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 shared_ptr<Entity> we have here -
// do some casting around instead
shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(_arrow);
bindTexture(TN_ITEM_ARROWS); // 4J - was L"/item/arrows.png"
bindTexture(_arrow); // 4J - was L"/item/arrows.png"
glPushMatrix();
@@ -83,4 +85,9 @@ void ArrowRenderer::render(shared_ptr<Entity> _arrow, double x, double y, double
}
glDisable(GL_RESCALE_NORMAL);
glPopMatrix();
}
ResourceLocation *ArrowRenderer::getTextureLocation(shared_ptr<Entity> mob)
{
return &ARROW_LOCATION;
}

View File

@@ -3,6 +3,10 @@
class ArrowRenderer : public EntityRenderer
{
private:
static ResourceLocation ARROW_LOCATION;
public:
virtual void render(shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a);
virtual ResourceLocation *getTextureLocation(shared_ptr<Entity> mob);
};

View File

@@ -0,0 +1,107 @@
#include "stdafx.h"
#include "..\Minecraft.World\net.minecraft.world.entity.ambient.h"
#include "BatModel.h"
#include "ModelPart.h"
BatModel::BatModel() : Model()
{
texWidth = 64;
texHeight = 64;
head = new ModelPart(this, 0, 0);
head->addBox(-3, -3, -3, 6, 6, 6);
ModelPart *rightEar = new ModelPart(this, 24, 0);
rightEar->addBox(-4, -6, -2, 3, 4, 1);
head->addChild(rightEar);
ModelPart *leftEar = new ModelPart(this, 24, 0);
leftEar->bMirror = true;
leftEar->addBox(1, -6, -2, 3, 4, 1);
head->addChild(leftEar);
body = new ModelPart(this, 0, 16);
body->addBox(-3, 4, -3, 6, 12, 6);
body->texOffs(0, 34)->addBox(-5, 16, 0, 10, 6, 1);
rightWing = new ModelPart(this, 42, 0);
rightWing->addBox(-12, 1, 1.5f, 10, 16, 1);
rightWingTip = new ModelPart(this, 24, 16);
rightWingTip->setPos(-12, 1, 1.5f);
rightWingTip->addBox(-8, 1, 0, 8, 12, 1);
leftWing = new ModelPart(this, 42, 0);
leftWing->bMirror = true;
leftWing->addBox(2, 1, 1.5f, 10, 16, 1);
leftWingTip = new ModelPart(this, 24, 16);
leftWingTip->bMirror = true;
leftWingTip->setPos(12, 1, 1.5f);
leftWingTip->addBox(0, 1, 0, 8, 12, 1);
body->addChild(rightWing);
body->addChild(leftWing);
rightWing->addChild(rightWingTip);
leftWing->addChild(leftWingTip);
// 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
head->compile(1.0f/16.0f);
body->compile(1.0f/16.0f);
rightWing->compile(1.0f/16.0f);
leftWing->compile(1.0f/16.0f);
rightWingTip->compile(1.0f/16.0f);
leftWingTip->compile(1.0f/16.0f);
rightEar->compile(1.0f/16.0f);
leftEar->compile(1.0f/16.0f);
}
int BatModel::modelVersion()
{
return 36;
}
void BatModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
{
shared_ptr<Bat> bat = dynamic_pointer_cast<Bat>(entity);
if (bat->isResting())
{
float rad = 180 / PI;
head->xRot = xRot / rad;
head->yRot = PI - yRot / rad;
head->zRot = PI;
head->setPos(0, -2, 0);
rightWing->setPos(-3, 0, 3);
leftWing->setPos(3, 0, 3);
body->xRot = PI;
rightWing->xRot = -PI * .05f;
rightWing->yRot = -PI * .40f;
rightWingTip->yRot = -PI * .55f;
leftWing->xRot = rightWing->xRot;
leftWing->yRot = -rightWing->yRot;
leftWingTip->yRot = -rightWingTip->yRot;
}
else
{
float rad = 180 / PI;
head->xRot = xRot / rad;
head->yRot = yRot / rad;
head->zRot = 0;
head->setPos(0, 0, 0);
rightWing->setPos(0, 0, 0);
leftWing->setPos(0, 0, 0);
body->xRot = PI * .25f + cos(bob * .1f) * .15f;
body->yRot = 0;
rightWing->yRot = cos(bob * 1.3f) * PI * .25f;
leftWing->yRot = -rightWing->yRot;
rightWingTip->yRot = rightWing->yRot * .5f;
leftWingTip->yRot = -rightWing->yRot * .5f;
}
head->render(scale, usecompiled);
body->render(scale, usecompiled);
}

View File

@@ -0,0 +1,20 @@
#pragma once
#include "Model.h"
class BatModel : public Model
{
private:
ModelPart *head;
ModelPart *body;
ModelPart *rightWing;
ModelPart *leftWing;
ModelPart *rightWingTip;
ModelPart *leftWingTip;
public:
BatModel();
int modelVersion();
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
};

View File

@@ -0,0 +1,50 @@
#include "stdafx.h"
#include "..\Minecraft.World\net.minecraft.world.entity.ambient.h"
#include "BatRenderer.h"
#include "BatModel.h"
ResourceLocation BatRenderer::BAT_LOCATION = ResourceLocation(TN_MOB_BAT);
BatRenderer::BatRenderer() : MobRenderer(new BatModel(), 0.25f)
{
modelVersion = ((BatModel *)model)->modelVersion();
}
void BatRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
{
int modelVersion = (dynamic_cast<BatModel*>(model))->modelVersion();
if (modelVersion != this->modelVersion) {
this->modelVersion = modelVersion;
model = new BatModel();
}
MobRenderer::render(_mob, x, y, z, rot, a);
}
ResourceLocation *BatRenderer::getTextureLocation(shared_ptr<Entity> mob)
{
return &BAT_LOCATION;
}
void BatRenderer::scale(shared_ptr<LivingEntity> mob, float a)
{
glScalef(.35f, .35f, .35f);
}
void BatRenderer::setupPosition(shared_ptr<LivingEntity> mob, double x, double y, double z)
{
MobRenderer::setupPosition(mob, x, y, z);
}
void BatRenderer::setupRotations(shared_ptr<LivingEntity> _mob, float bob, float bodyRot, float a)
{
shared_ptr<Bat> mob = dynamic_pointer_cast<Bat>(_mob);
if (!mob->isResting())
{
glTranslatef(0, cos(bob * .3f) * .1f, 0);
}
else
{
glTranslatef(0, -.1f, 0);
}
MobRenderer::setupRotations(mob, bob, bodyRot, a);
}

View File

@@ -0,0 +1,20 @@
#pragma once
#include "MobRenderer.h"
class BatModel;
class BatRenderer : public MobRenderer
{
static ResourceLocation BAT_LOCATION;
int modelVersion;
public:
BatRenderer();
virtual void render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a);
protected:
virtual ResourceLocation *getTextureLocation(shared_ptr<Entity> mob);
virtual void scale(shared_ptr<LivingEntity> mob, float a);
virtual void setupPosition(shared_ptr<LivingEntity> mob, double x, double y, double z);
virtual void setupRotations(shared_ptr<LivingEntity> mob, float bob, float bodyRot, float a);
};

View File

@@ -0,0 +1,138 @@
#include "stdafx.h"
#include "..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
#include "..\Minecraft.World\net.minecraft.world.level.h"
#include "BeaconRenderer.h"
#include "Tesselator.h"
ResourceLocation BeaconRenderer::BEAM_LOCATION = ResourceLocation(TN_MISC_BEACON_BEAM);
void BeaconRenderer::render(shared_ptr<TileEntity> _beacon, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled)
{
shared_ptr<BeaconTileEntity> beacon = dynamic_pointer_cast<BeaconTileEntity>(_beacon);
float scale = beacon->getAndUpdateClientSideScale();
if (scale > 0)
{
Tesselator *t = Tesselator::getInstance();
bindTexture(&BEAM_LOCATION);
// TODO: 4J: Put this back in
//assert(0);
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
glDepthMask(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
float tt = beacon->getLevel()->getGameTime() + a;
float texVOff = -tt * .20f - floor(-tt * .10f);
{
int r = 1;
double rot = tt * .025 * (1 - (r & 1) * 2.5);
t->begin();
t->color(255, 255, 255, 32);
double rr1 = r * 0.2;
double wnx = .5 + cos(rot + PI * .75) * rr1;
double wnz = .5 + sin(rot + PI * .75) * rr1;
double enx = .5 + cos(rot + PI * .25) * rr1;
double enz = .5 + sin(rot + PI * .25) * rr1;
double wsx = .5 + cos(rot + PI * 1.25) * rr1;
double wsz = .5 + sin(rot + PI * 1.25) * rr1;
double esx = .5 + cos(rot + PI * 1.75) * rr1;
double esz = .5 + sin(rot + PI * 1.75) * rr1;
double top = 256 * scale;
double uu1 = 0;
double uu2 = 1;
double vv2 = -1 + texVOff;
double vv1 = 256 * scale * (.5 / rr1) + vv2;
t->vertexUV(x + wnx, y + top, z + wnz, uu2, vv1);
t->vertexUV(x + wnx, y, z + wnz, uu2, vv2);
t->vertexUV(x + enx, y, z + enz, uu1, vv2);
t->vertexUV(x + enx, y + top, z + enz, uu1, vv1);
t->vertexUV(x + esx, y + top, z + esz, uu2, vv1);
t->vertexUV(x + esx, y, z + esz, uu2, vv2);
t->vertexUV(x + wsx, y, z + wsz, uu1, vv2);
t->vertexUV(x + wsx, y + top, z + wsz, uu1, vv1);
t->vertexUV(x + enx, y + top, z + enz, uu2, vv1);
t->vertexUV(x + enx, y, z + enz, uu2, vv2);
t->vertexUV(x + esx, y, z + esz, uu1, vv2);
t->vertexUV(x + esx, y + top, z + esz, uu1, vv1);
t->vertexUV(x + wsx, y + top, z + wsz, uu2, vv1);
t->vertexUV(x + wsx, y, z + wsz, uu2, vv2);
t->vertexUV(x + wnx, y, z + wnz, uu1, vv2);
t->vertexUV(x + wnx, y + top, z + wnz, uu1, vv1);
t->end();
}
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(false);
{
t->begin();
t->color(255, 255, 255, 32);
double wnx = .2;
double wnz = .2;
double enx = .8;
double enz = .2;
double wsx = .2;
double wsz = .8;
double esx = .8;
double esz = .8;
double top = 256 * scale;
double uu1 = 0;
double uu2 = 1;
double vv2 = -1 + texVOff;
double vv1 = 256 * scale + vv2;
t->vertexUV(x + wnx, y + top, z + wnz, uu2, vv1);
t->vertexUV(x + wnx, y, z + wnz, uu2, vv2);
t->vertexUV(x + enx, y, z + enz, uu1, vv2);
t->vertexUV(x + enx, y + top, z + enz, uu1, vv1);
t->vertexUV(x + esx, y + top, z + esz, uu2, vv1);
t->vertexUV(x + esx, y, z + esz, uu2, vv2);
t->vertexUV(x + wsx, y, z + wsz, uu1, vv2);
t->vertexUV(x + wsx, y + top, z + wsz, uu1, vv1);
t->vertexUV(x + enx, y + top, z + enz, uu2, vv1);
t->vertexUV(x + enx, y, z + enz, uu2, vv2);
t->vertexUV(x + esx, y, z + esz, uu1, vv2);
t->vertexUV(x + esx, y + top, z + esz, uu1, vv1);
t->vertexUV(x + wsx, y + top, z + wsz, uu2, vv1);
t->vertexUV(x + wsx, y, z + wsz, uu2, vv2);
t->vertexUV(x + wnx, y, z + wnz, uu1, vv2);
t->vertexUV(x + wnx, y + top, z + wnz, uu1, vv1);
t->end();
}
glEnable(GL_LIGHTING);
glEnable(GL_TEXTURE_2D);
glDepthMask(true);
}
}

View File

@@ -0,0 +1,13 @@
#pragma once
#include "TileEntityRenderer.h"
class BeaconTileEntity;
class BeaconRenderer : public TileEntityRenderer
{
private:
static ResourceLocation BEAM_LOCATION;
public:
virtual void render(shared_ptr<TileEntity> _beacon, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled);
};

View File

@@ -32,18 +32,17 @@ int BlazeModel::modelVersion()
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);
setupAnim(time, r, bob, yRot, xRot, scale, entity);
head->render(scale,usecompiled);
head->render(scale, usecompiled);
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, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim)
{
float angle = bob * PI * -.1f;
for (int i = 0; i < 4; i++)
{

View File

@@ -12,5 +12,5 @@ public:
BlazeModel();
int modelVersion();
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0);
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim = 0);
};

View File

@@ -3,9 +3,11 @@
#include "..\Minecraft.World\net.minecraft.world.entity.monster.h"
#include "BlazeRenderer.h"
ResourceLocation BlazeRenderer::BLAZE_LOCATION = ResourceLocation(TN_MOB_BLAZE);
BlazeRenderer::BlazeRenderer() : MobRenderer(new BlazeModel(), 0.5f)
{
this->modelVersion = ((BlazeModel *) model)->modelVersion();
modelVersion = ((BlazeModel *) model)->modelVersion();
}
void BlazeRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
@@ -21,4 +23,9 @@ void BlazeRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z
model = new BlazeModel();
}
MobRenderer::render(mob, x, y, z, rot, a);
}
ResourceLocation *BlazeRenderer::getTextureLocation(shared_ptr<Entity> mob)
{
return &BLAZE_LOCATION;
}

View File

@@ -1,14 +1,15 @@
#pragma once
#include "MobRenderer.h"
class BlazeRenderer : public MobRenderer
{
private:
int modelVersion;
static ResourceLocation BLAZE_LOCATION;
int modelVersion;
public:
BlazeRenderer();
virtual void render(shared_ptr<Entity> mob, double x, double y, double z, float rot, float a);
virtual ResourceLocation *getTextureLocation(shared_ptr<Entity> mob);
};

View File

@@ -4,6 +4,8 @@
#include "..\Minecraft.World\net.minecraft.world.entity.item.h"
#include "..\Minecraft.World\Mth.h"
ResourceLocation BoatRenderer::BOAT_LOCATION = ResourceLocation(TN_ITEM_BOAT);
BoatRenderer::BoatRenderer() : EntityRenderer()
{
this->shadowRadius = 0.5f;
@@ -29,13 +31,17 @@ void BoatRenderer::render(shared_ptr<Entity> _boat, double x, double y, double z
glRotatef(Mth::sin(hurt)*hurt*dmg/10*boat->getHurtDir(), 1, 0, 0);
}
bindTexture(TN_TERRAIN); // 4J was L"/terrain.png"
float ss = 12/16.0f;
glScalef(ss, ss, ss);
glScalef(1/ss, 1/ss, 1/ss);
bindTexture(TN_ITEM_BOAT); // 4J was L"/item/boat.png"
bindTexture(boat);
glScalef(-1, -1, 1);
model->render(boat, 0, 0, -0.1f, 0, 0, 1 / 16.0f, true);
glPopMatrix();
}
ResourceLocation *BoatRenderer::getTextureLocation(shared_ptr<Entity> mob)
{
return &BOAT_LOCATION;
}

View File

@@ -3,11 +3,14 @@
class BoatRenderer : public EntityRenderer
{
private:
static ResourceLocation BOAT_LOCATION;
protected:
Model *model;
public:
BoatRenderer();
virtual void render(shared_ptr<Entity> boat, double x, double y, double z, float rot, float a);
virtual ResourceLocation *getTextureLocation(shared_ptr<Entity> mob);
};

View File

@@ -35,7 +35,7 @@ BookModel::BookModel()
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);
setupAnim(time, r, bob, yRot, xRot, scale, entity);
leftLid->render(scale,usecompiled);
rightLid->render(scale,usecompiled);
@@ -48,7 +48,7 @@ void BookModel::render(shared_ptr<Entity> entity, float time, float r, float bob
flipPage2->render(scale,usecompiled);
}
void BookModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim)
void BookModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim)
{
float openness = (Mth::sin(time * 0.02f) * 0.10f + 1.25f) * yRot;

View File

@@ -12,5 +12,5 @@ public:
BookModel();
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);
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim = 0);
};

View File

@@ -0,0 +1,16 @@
#include "stdafx.h"
#include "BossMobGuiInfo.h"
#include "../Minecraft.World/BossMob.h"
float BossMobGuiInfo::healthProgress = 0.0f;
int BossMobGuiInfo::displayTicks = 0;
wstring BossMobGuiInfo::name = L"";
bool BossMobGuiInfo::darkenWorld = false;
void BossMobGuiInfo::setBossHealth(shared_ptr<BossMob> boss, bool darkenWorld)
{
healthProgress = (float) boss->getHealth() / (float) boss->getMaxHealth();
displayTicks = SharedConstants::TICKS_PER_SECOND * 5;
name = boss->getAName();
BossMobGuiInfo::darkenWorld = darkenWorld;
}

View File

@@ -0,0 +1,14 @@
#pragma once
class BossMob;
class BossMobGuiInfo
{
public:
static float healthProgress;
static int displayTicks;
static wstring name;
static bool darkenWorld;
static void setBossHealth(shared_ptr<BossMob> boss, bool darkenWorld);
};

View File

@@ -162,7 +162,7 @@ BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=f
const char *pchTextureName=wstringtofilename(name);
#ifdef _DEBUG
#ifndef _CONTENT_PACKAGE
app.DebugPrintf("\n--- Loading TEXTURE - %s\n\n",pchTextureName);
#endif

View File

@@ -88,12 +88,12 @@ void Camera::prepare(shared_ptr<Player> player, bool mirror)
ya = cosf(xRot * PI / 180.0f);
}
TilePos *Camera::getCameraTilePos(shared_ptr<Mob> player, double alpha)
TilePos *Camera::getCameraTilePos(shared_ptr<LivingEntity> player, double alpha)
{
return new TilePos(getCameraPos(player, alpha));
}
Vec3 *Camera::getCameraPos(shared_ptr<Mob> player, double alpha)
Vec3 *Camera::getCameraPos(shared_ptr<LivingEntity> 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(shared_ptr<Mob> player, double alpha)
return Vec3::newTemp(xt, yt, zt);
}
int Camera::getBlockAt(Level *level, shared_ptr<Mob> player, float alpha)
int Camera::getBlockAt(Level *level, shared_ptr<LivingEntity> player, float alpha)
{
Vec3 *p = Camera::getCameraPos(player, alpha);
TilePos tp = TilePos(p);

View File

@@ -26,7 +26,7 @@ public:
static void prepare(shared_ptr<Player> player, bool mirror);
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);
static TilePos *getCameraTilePos(shared_ptr<LivingEntity> player, double alpha);
static Vec3 *getCameraPos(shared_ptr<LivingEntity> player, double alpha);
static int getBlockAt(Level *level, shared_ptr<LivingEntity> player, float alpha);
};

View File

@@ -0,0 +1,20 @@
#include "stdafx.h"
#include "CaveSpiderRenderer.h"
ResourceLocation CaveSpiderRenderer::CAVE_SPIDER_LOCATION = ResourceLocation(TN_MOB_CAVE_SPIDER);
float CaveSpiderRenderer::s_scale = 0.7f;
CaveSpiderRenderer::CaveSpiderRenderer() : SpiderRenderer()
{
shadowRadius *= s_scale;
}
void CaveSpiderRenderer::scale(shared_ptr<LivingEntity> mob, float a)
{
glScalef(s_scale, s_scale, s_scale);
}
ResourceLocation *CaveSpiderRenderer::getTextureLocation(shared_ptr<Entity> mob)
{
return &CAVE_SPIDER_LOCATION;
}

View File

@@ -0,0 +1,18 @@
#pragma once
#include "SpiderRenderer.h"
class CaveSpider;
class CaveSpiderRenderer : public SpiderRenderer
{
private:
static ResourceLocation CAVE_SPIDER_LOCATION;
static float s_scale;
public:
CaveSpiderRenderer();
protected:
virtual void scale(shared_ptr<LivingEntity> mob, float a);
virtual ResourceLocation *getTextureLocation(shared_ptr<Entity> mob);
};

View File

@@ -5,11 +5,29 @@
#include "ModelPart.h"
#include "..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
#include "..\Minecraft.World\Calendar.h"
ChestRenderer::ChestRenderer()
ResourceLocation ChestRenderer::CHEST_LARGE_TRAP_LOCATION = ResourceLocation(TN_TILE_LARGE_TRAP_CHEST);
//ResourceLocation ChestRenderer::CHEST_LARGE_XMAS_LOCATION = ResourceLocation(TN_TILE_LARGE_XMAS_CHEST);
ResourceLocation ChestRenderer::CHEST_LARGE_LOCATION = ResourceLocation(TN_TILE_LARGE_CHEST);
ResourceLocation ChestRenderer::CHEST_TRAP_LOCATION = ResourceLocation(TN_TILE_TRAP_CHEST);
//ResourceLocation ChestRenderer::CHEST_XMAS_LOCATION = ResourceLocation(TN_TILE_XMAS_CHEST);
ResourceLocation ChestRenderer::CHEST_LOCATION = ResourceLocation(TN_TILE_CHEST);
ChestRenderer::ChestRenderer() : TileEntityRenderer()
{
chestModel = new ChestModel();
largeChestModel = new LargeChestModel();
xmasTextures = false;
// 4J Stu - Disable this
#if 0
if (Calendar::GetMonth() + 1 == 12 && Calendar::GetDayOfMonth() >= 24 && Calendar::GetDayOfMonth() <= 26)
{
xmasTextures = true;
}
#endif
}
ChestRenderer::~ChestRenderer()
@@ -34,7 +52,7 @@ void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, d
Tile *tile = chest->getTile();
data = chest->getData();
if (tile != NULL && data == 0)
if (dynamic_cast<ChestTile*>(tile) != NULL && data == 0)
{
((ChestTile *) tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z);
data = chest->getData();
@@ -49,12 +67,35 @@ void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, d
if (chest->e.lock() != NULL || chest->s.lock() != NULL)
{
model = largeChestModel;
bindTexture(TN_TILE_LARGE_CHEST); // 4J Was "/item/largechest.png"
if (chest->getType() == ChestTile::TYPE_TRAP)
{
bindTexture(&CHEST_LARGE_TRAP_LOCATION);
}
//else if (xmasTextures)
//{
// bindTexture(&CHEST_LARGE_XMAS_LOCATION);
//}
else
{
bindTexture(&CHEST_LARGE_LOCATION);
}
}
else
{
model = chestModel;
bindTexture(TN_TILE_CHEST); // 4J Was "/item/chest.png"
if (chest->getType() == ChestTile::TYPE_TRAP)
{
bindTexture(&CHEST_TRAP_LOCATION);
}
//else if (xmasTextures)
//{
// bindTexture(&CHEST_XMAS_LOCATION);
//}
else
{
bindTexture(&CHEST_LOCATION);
}
}
glPushMatrix();

View File

@@ -1,5 +1,4 @@
#pragma once
#include "TileEntityRenderer.h"
class ChestModel;
@@ -7,8 +6,16 @@ class ChestModel;
class ChestRenderer : public TileEntityRenderer
{
private:
static ResourceLocation CHEST_LARGE_TRAP_LOCATION;
//static ResourceLocation CHEST_LARGE_XMAS_LOCATION;
static ResourceLocation CHEST_LARGE_LOCATION;
static ResourceLocation CHEST_TRAP_LOCATION;
//static ResourceLocation CHEST_XMAS_LOCATION;
static ResourceLocation CHEST_LOCATION;
ChestModel *chestModel;
ChestModel *largeChestModel;
boolean xmasTextures;
public:
ChestRenderer();

View File

@@ -51,7 +51,7 @@ ChickenModel::ChickenModel() : Model()
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);
setupAnim(time, r, bob, yRot, xRot, scale, entity);
if (young)
{
float ss = 2;
@@ -84,7 +84,7 @@ void ChickenModel::render(shared_ptr<Entity> entity, float time, float r, float
}
}
void ChickenModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim)
void ChickenModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim)
{
head->xRot = xRot / (float) (180 / PI);
head->yRot = yRot / (float) (180 / PI);

View File

@@ -6,6 +6,6 @@ public:
ModelPart *head, *hair, *body, *leg0, *leg1, *wing0,* wing1, *beak, *redThing;
ChickenModel();
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);
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, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim = 0);
};

View File

@@ -3,6 +3,8 @@
#include "ChickenRenderer.h"
#include "..\Minecraft.World\net.minecraft.world.entity.animal.h"
ResourceLocation ChickenRenderer::CHICKEN_LOCATION = ResourceLocation(TN_MOB_CHICKEN);
ChickenRenderer::ChickenRenderer(Model *model, float shadow) : MobRenderer(model,shadow)
{
}
@@ -12,7 +14,7 @@ void ChickenRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
MobRenderer::render(_mob, x, y, z, rot, a);
}
float ChickenRenderer::getBob(shared_ptr<Mob> _mob, float a)
float ChickenRenderer::getBob(shared_ptr<LivingEntity> _mob, float a)
{
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Chicken> mob = dynamic_pointer_cast<Chicken>(_mob);
@@ -21,4 +23,9 @@ float ChickenRenderer::getBob(shared_ptr<Mob> _mob, float a)
float flapSpeed = mob->oFlapSpeed+(mob->flapSpeed-mob->oFlapSpeed)*a;
return (Mth::sin(flap)+1)*flapSpeed;
}
ResourceLocation *ChickenRenderer::getTextureLocation(shared_ptr<Entity> mob)
{
return &CHICKEN_LOCATION;
}

View File

@@ -3,9 +3,14 @@
class ChickenRenderer : public MobRenderer
{
private:
static ResourceLocation CHICKEN_LOCATION;
public:
ChickenRenderer(Model *model, float shadow);
virtual void render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a);
virtual ResourceLocation *getTextureLocation(shared_ptr<Entity> mob);
protected:
virtual float getBob(shared_ptr<Mob> _mob, float a);
virtual float getBob(shared_ptr<LivingEntity> _mob, float a);
};

View File

@@ -15,6 +15,8 @@
#include "C4JThread_SPU.h"
#include "C4JSpursJob.h"
//#define DISABLE_SPU_CODE
#endif
int Chunk::updates = 0;
@@ -233,7 +235,7 @@ void Chunk::rebuild()
byteArray tileArray = byteArray(tileIds, 16 * 16 * Level::maxBuildHeight);
level->getChunkAt(x,z)->getBlockData(tileArray); // 4J - TODO - now our data has been re-arranged, we could just extra the vertical slice of this chunk rather than the whole thing
LevelSource *region = new Region(level, x0 - r, y0 - r, z0 - r, x1 + r, y1 + r, z1 + r);
LevelSource *region = new Region(level, x0 - r, y0 - r, z0 - r, x1 + r, y1 + r, z1 + r, r);
TileRenderer *tileRenderer = new TileRenderer(region, this->x, this->y, this->z, tileIds);
// AP - added a caching system for Chunk::rebuild to take advantage of
@@ -278,15 +280,15 @@ void Chunk::rebuild()
// 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;
if( !( ( tileId == Tile::stone_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
tileId = tileIds[ offset + ( ( ( xx - 1 ) << 11 ) | ( ( zz + 0 ) << 7 ) | ( indexY + 0 )) ];
if( !( ( tileId == Tile::rock_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
if( !( ( tileId == Tile::stone_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
tileId = tileIds[ offset + ( ( ( xx + 1 ) << 11 ) | ( ( zz + 0 ) << 7 ) | ( indexY + 0 )) ];
if( !( ( tileId == Tile::rock_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
if( !( ( tileId == Tile::stone_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
tileId = tileIds[ offset + ( ( ( xx + 0 ) << 11 ) | ( ( zz - 1 ) << 7 ) | ( indexY + 0 )) ];
if( !( ( tileId == Tile::rock_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
if( !( ( tileId == Tile::stone_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
tileId = tileIds[ offset + ( ( ( xx + 0 ) << 11 ) | ( ( zz + 1 ) << 7 ) | ( indexY + 0 )) ];
if( !( ( tileId == Tile::rock_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
if( !( ( tileId == Tile::stone_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
// Treat the bottom of the world differently - we shouldn't ever be able to look up at this, so consider tiles as invisible
// if they are surrounded on sides other than the bottom
if( yy > 0 )
@@ -299,7 +301,7 @@ void Chunk::rebuild()
yMinusOneOffset = Level::COMPRESSED_CHUNK_SECTION_TILES;
}
tileId = tileIds[ yMinusOneOffset + ( ( ( xx + 0 ) << 11 ) | ( ( zz + 0 ) << 7 ) | indexYMinusOne ) ];
if( !( ( tileId == Tile::rock_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
if( !( ( tileId == Tile::stone_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
}
int indexYPlusOne = yy + 1;
int yPlusOneOffset = 0;
@@ -309,7 +311,7 @@ void Chunk::rebuild()
yPlusOneOffset = Level::COMPRESSED_CHUNK_SECTION_TILES;
}
tileId = tileIds[ yPlusOneOffset + ( ( ( xx + 0 ) << 11 ) | ( ( zz + 0 ) << 7 ) | indexYPlusOne ) ];
if( !( ( tileId == Tile::rock_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
if( !( ( tileId == Tile::stone_Id ) || ( tileId == Tile::dirt_Id ) || ( tileId == Tile::unbreakable_Id ) || ( tileId == 255) ) ) continue;
// This tile is surrounded. Flag it as not requiring to be rendered by setting its id to 255.
tileIds[ offset + ( ( ( xx + 0 ) << 11 ) | ( ( zz + 0 ) << 7 ) | ( indexY + 0 ) ) ] = 0xff;
@@ -618,8 +620,6 @@ ChunkRebuildData g_rebuildDataOut __attribute__((__aligned__(16)));
TileCompressData_SPU g_tileCompressDataIn __attribute__((__aligned__(16)));
unsigned char* g_tileCompressDataOut = (unsigned char*)&g_rebuildDataIn.m_tileIds;
#define TILE_RENDER_SPU
void RunSPURebuild()
{
@@ -667,7 +667,7 @@ void Chunk::rebuild_SPU()
int r = 1;
Region region(level, x0 - r, y0 - r, z0 - r, x1 + r, y1 + r, z1 + r);
Region region(level, x0 - r, y0 - r, z0 - r, x1 + r, y1 + r, z1 + r, r);
TileRenderer tileRenderer(&region);
int lists = levelRenderer->getGlobalIndexForChunk(this->x,this->y,this->z,level) * 2;
@@ -722,19 +722,12 @@ void Chunk::rebuild_SPU()
intArray_SPU tesselatorArray((unsigned int*)g_rebuildDataIn.m_tesselator.m_PPUArray);
g_rebuildDataIn.m_tesselator._array = &tesselatorArray;
g_rebuildDataIn.m_currentLayer = currentLayer;
#ifdef TILE_RENDER_SPU
g_tileCompressDataIn.setForChunk(&region, x0, y0, z0);
RunSPURebuild();
g_rebuildDataOut.storeInTesselator();
pOutData = &g_rebuildDataOut;
#else
g_rebuildDataIn.disableUnseenTiles();
TileRenderer_SPU *pTileRenderer = new TileRenderer_SPU(&g_rebuildDataIn);
g_rebuildDataIn.tesselateAllTiles(pTileRenderer);
g_rebuildDataIn.storeInTesselator();
pOutData = &g_rebuildDataIn;
#endif
if(pOutData->m_flags & ChunkRebuildData::e_flag_Rendered)
if(pOutData->m_flags & ChunkRebuildData::e_flag_Rendered)
rendered = true;
// 4J - changed loop order here to leave y as the innermost loop for better cache performance

File diff suppressed because it is too large Load Diff

View File

@@ -17,6 +17,7 @@ private:
eCCLoginReceived,
eCCConnected
};
private:
bool done;
Connection *connection;
@@ -58,6 +59,7 @@ public:
virtual void handleSetEntityData(shared_ptr<SetEntityDataPacket> packet);
virtual void handleAddPlayer(shared_ptr<AddPlayerPacket> packet);
virtual void handleTeleportEntity(shared_ptr<TeleportEntityPacket> packet);
virtual void handleSetCarriedItem(shared_ptr<SetCarriedItemPacket> packet);
virtual void handleMoveEntity(shared_ptr<MoveEntityPacket> packet);
virtual void handleRotateMob(shared_ptr<RotateHeadPacket> packet);
virtual void handleMoveEntitySmall(shared_ptr<MoveEntityPacketSmall> packet);
@@ -86,7 +88,7 @@ public:
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 handleEntityLinkPacket(shared_ptr<SetEntityLinkPacket> packet);
virtual void handleEntityEvent(shared_ptr<EntityEventPacket> packet);
private:
shared_ptr<Entity> getEntity(int entityId);
@@ -100,6 +102,7 @@ public:
virtual void handleContainerSetSlot(shared_ptr<ContainerSetSlotPacket> packet);
virtual void handleContainerAck(shared_ptr<ContainerAckPacket> packet);
virtual void handleContainerContent(shared_ptr<ContainerSetContentPacket> packet);
virtual void handleTileEditorOpen(shared_ptr<TileEditorOpenPacket> packet);
virtual void handleSignUpdate(shared_ptr<SignUpdatePacket> packet);
virtual void handleTileEntityData(shared_ptr<TileEntityDataPacket> packet);
virtual void handleContainerSetData(shared_ptr<ContainerSetDataPacket> packet);
@@ -137,4 +140,27 @@ public:
virtual void handleXZ(shared_ptr<XZPacket> packet);
void displayPrivilegeChanges(shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges);
virtual void handleAddObjective(shared_ptr<SetObjectivePacket> packet);
virtual void handleSetScore(shared_ptr<SetScorePacket> packet);
virtual void handleSetDisplayObjective(shared_ptr<SetDisplayObjectivePacket> packet);
virtual void handleSetPlayerTeamPacket(shared_ptr<SetPlayerTeamPacket> packet);
virtual void handleParticleEvent(shared_ptr<LevelParticlesPacket> packet);
virtual void handleUpdateAttributes(shared_ptr<UpdateAttributesPacket> packet);
private:
// 4J: Entity link packet deferred
class DeferredEntityLinkPacket
{
public:
DWORD m_recievedTick;
shared_ptr<SetEntityLinkPacket> m_packet;
DeferredEntityLinkPacket(shared_ptr<SetEntityLinkPacket> packet);
};
vector<DeferredEntityLinkPacket> deferredEntityLinkPackets;
static const int MAX_ENTITY_LINK_DEFERRAL_INTERVAL = 1000;
void checkDeferredEntityLinkPackets(int newEntityId);
};

View File

@@ -7,14 +7,14 @@
#include "Texture.h"
#include "ClockTexture.h"
ClockTexture::ClockTexture() : StitchedTexture(L"compass")
ClockTexture::ClockTexture() : StitchedTexture(L"clock", L"clock")
{
rot = rota = 0.0;
m_dataTexture = NULL;
m_iPad = XUSER_INDEX_ANY;
}
ClockTexture::ClockTexture(int iPad, ClockTexture *dataTexture) : StitchedTexture(L"compass")
ClockTexture::ClockTexture(int iPad, ClockTexture *dataTexture) : StitchedTexture(L"clock", L"clock")
{
rot = rota = 0.0;
m_dataTexture = dataTexture;

View File

@@ -36,8 +36,29 @@
#define GAME_HOST_OPTION_BITMASK_HOSTINVISIBLE 0x00010000
#define GAME_HOST_OPTION_BITMASK_BEDROCKFOG 0x00020000
#define GAME_HOST_OPTION_BITMASK_DISABLESAVE 0x00040000
#define GAME_HOST_OPTION_BITMASK_NOTOWNER 0x00080000
#define GAME_HOST_OPTION_BITMASK_WORLDSIZE 0x00700000 // 3 bits, 5 values (unset(0), classic(1), small(2), medium(3), large(4))
#define GAME_HOST_OPTION_BITMASK_MOBGRIEFING 0x00800000
#define GAME_HOST_OPTION_BITMASK_KEEPINVENTORY 0x01000000
#define GAME_HOST_OPTION_BITMASK_DOMOBSPAWNING 0x02000000
#define GAME_HOST_OPTION_BITMASK_DOMOBLOOT 0x04000000
#define GAME_HOST_OPTION_BITMASK_DOTILEDROPS 0x08000000
#define GAME_HOST_OPTION_BITMASK_NATURALREGEN 0x10000000
#define GAME_HOST_OPTION_BITMASK_DODAYLIGHTCYCLE 0x20000000
#define GAME_HOST_OPTION_BITMASK_ALL 0xFFFFFFFF
#define GAME_HOST_OPTION_BITMASK_WORLDSIZE_BITSHIFT 20
enum EGameHostOptionWorldSize
{
e_worldSize_Unknown = 0,
e_worldSize_Classic,
e_worldSize_Small,
e_worldSize_Medium,
e_worldSize_Large
};
#ifdef _XBOX
#define PROFILE_VERSION_1 1
#define PROFILE_VERSION_2 2
@@ -53,7 +74,12 @@
#define PROFILE_VERSION_10 12
// 4J-JEV: New Statistics and Achievements for 'NexGen' platforms.
#define PROFILE_VERSION_BUILD_JUNE14 13
#define PROFILE_VERSION_11 13
// Java 1.6.4
#define PROFILE_VERSION_12 14
#define PROFILE_VERSION_CURRENT PROFILE_VERSION_12
#define MAX_FAVORITE_SKINS 10 // these are stored in the profile data so keep it small

View File

@@ -73,6 +73,7 @@ enum eXuiAction
eAppAction_LevelInBanLevelList,
eAppAction_ReloadTexturePack,
eAppAction_ReloadFont,
eAppAction_TexturePackRequired, // when the user has joined from invite, but doesn't have the texture pack
#ifdef __ORBIS__
@@ -380,6 +381,10 @@ enum eMinecraftColour
eMinecraftColour_Effect_Hunger,
eMinecraftColour_Effect_Weakness,
eMinecraftColour_Effect_Poison,
eMinecraftColour_Effect_Wither,
eMinecraftColour_Effect_HealthBoost,
eMinecraftColour_Effect_Absoprtion,
eMinecraftColour_Effect_Saturation,
eMinecraftColour_Potion_BaseColour,
@@ -425,6 +430,12 @@ enum eMinecraftColour
eMinecraftColour_Mob_Ocelot_Colour2,
eMinecraftColour_Mob_Villager_Colour1,
eMinecraftColour_Mob_Villager_Colour2,
eMinecraftColour_Mob_Bat_Colour1,
eMinecraftColour_Mob_Bat_Colour2,
eMinecraftColour_Mob_Witch_Colour1,
eMinecraftColour_Mob_Witch_Colour2,
eMinecraftColour_Mob_Horse_Colour1,
eMinecraftColour_Mob_Horse_Colour2,
eMinecraftColour_Armour_Default_Leather_Colour,
@@ -443,6 +454,11 @@ enum eMinecraftColour
eMinecraftColour_Sign_Text,
eMinecraftColour_Map_Text,
eMinecraftColour_Leash_Light_Colour,
eMinecraftColour_Leash_Dark_Colour,
eMinecraftColour_Fire_Overlay,
eHTMLColor_0,
eHTMLColor_1,
eHTMLColor_2,
@@ -487,20 +503,20 @@ enum eMinecraftColour
eTextColor_RenamedItemTitle,
//eHTMLColor_0 = 0x000000, //r:0 , g: 0, b: 0, i: 0
//eHTMLColor_1 = 0x0000aa, //r:0 , g: 0, b: aa, i: 1
//eHTMLColor_2 = 0x109e10, // Changed by request of Dave //0x00aa00, //r:0 , g: aa, b: 0, i: 2
//eHTMLColor_3 = 0x109e9e, // Changed by request of Dave //0x00aaaa, //r:0 , g: aa, b: aa, i: 3
//eHTMLColor_4 = 0xaa0000, //r:aa , g: 0, b: 0, i: 4
//eHTMLColor_5 = 0xaa00aa, //r:aa , g: 0, b: aa, i: 5
//eHTMLColor_6 = 0xffaa00, //r:ff , g: aa, b: 0, i: 6
//eHTMLColor_7 = 0xaaaaaa, //r:aa , g: aa, b: aa, i: 7
//eHTMLColor_8 = 0x555555, //r:55 , g: 55, b: 55, i: 8
//eHTMLColor_9 = 0x5555ff, //r:55 , g: 55, b: ff, i: 9
//eHTMLColor_a = 0x55ff55, //r:55 , g: ff, b: 55, i: a
//eHTMLColor_b = 0x55ffff, //r:55 , g: ff, b: ff, i: b
//eHTMLColor_c = 0xff5555, //r:ff , g: 55, b: 55, i: c
//eHTMLColor_d = 0xff55ff, //r:ff , g: 55, b: ff, i: d
//eHTMLColor_e = 0xffff55, //r:ff , g: ff, b: 55, i: e
//eHTMLColor_1 = 0x0000aa, //r:0 , g: 0, b: aa, i: 1 // blue, quite dark
//eHTMLColor_2 = 0x109e10, // Changed by request of Dave //0x00aa00, //r:0 , g: aa, b: 0, i: 2 // green
//eHTMLColor_3 = 0x109e9e, // Changed by request of Dave //0x00aaaa, //r:0 , g: aa, b: aa, i: 3 // cyan
//eHTMLColor_4 = 0xaa0000, //r:aa , g: 0, b: 0, i: 4 // red
//eHTMLColor_5 = 0xaa00aa, //r:aa , g: 0, b: aa, i: 5 // purple
//eHTMLColor_6 = 0xffaa00, //r:ff , g: aa, b: 0, i: 6 // orange
//eHTMLColor_7 = 0xaaaaaa, //r:aa , g: aa, b: aa, i: 7 // light gray
//eHTMLColor_8 = 0x555555, //r:55 , g: 55, b: 55, i: 8 // gray
//eHTMLColor_9 = 0x5555ff, //r:55 , g: 55, b: ff, i: 9 // blue
//eHTMLColor_a = 0x55ff55, //r:55 , g: ff, b: 55, i: a // green
//eHTMLColor_b = 0x55ffff, //r:55 , g: ff, b: ff, i: b // cyan
//eHTMLColor_c = 0xff5555, //r:ff , g: 55, b: 55, i: c // red pink
//eHTMLColor_d = 0xff55ff, //r:ff , g: 55, b: ff, i: d // bright pink
//eHTMLColor_e = 0xffff55, //r:ff , g: ff, b: 55, i: e // yellow
//eHTMLColor_f = 0xffffff, //r:ff , g: ff, b: ff, i: f
//eHTMLColor_0_dark = 0x000000, //r:0 , g: 0, b: 0, i: 10
//eHTMLColor_1_dark = 0x00002a, //r:0 , g: 0, b: 2a, i: 11
@@ -509,12 +525,12 @@ enum eMinecraftColour
//eHTMLColor_4_dark = 0x2a0000, //r:2a , g: 0, b: 0, i: 14
//eHTMLColor_5_dark = 0x2a002a, //r:2a , g: 0, b: 2a, i: 15
//eHTMLColor_6_dark = 0x2a2a00, //r:2a , g: 2a, b: 0, i: 16
//eHTMLColor_7_dark = 0x2a2a2a, //r:2a , g: 2a, b: 2a, i: 17
//eHTMLColor_7_dark = 0x2a2a2a, //r:2a , g: 2a, b: 2a, i: 17 // dark gray
//eHTMLColor_8_dark = 0x151515, //r:15 , g: 15, b: 15, i: 18
//eHTMLColor_9_dark = 0x15153f, //r:15 , g: 15, b: 3f, i: 19
//eHTMLColor_a_dark = 0x153f15, //r:15 , g: 3f, b: 15, i: 1a
//eHTMLColor_b_dark = 0x153f3f, //r:15 , g: 3f, b: 3f, i: 1b
//eHTMLColor_c_dark = 0x3f1515, //r:3f , g: 15, b: 15, i: 1c
//eHTMLColor_c_dark = 0x3f1515, //r:3f , g: 15, b: 15, i: 1c // brown
//eHTMLColor_d_dark = 0x3f153f, //r:3f , g: 15, b: 3f, i: 1d
//eHTMLColor_e_dark = 0x3f3f15, //r:3f , g: 3f, b: 15, i: 1e
//eHTMLColor_f_dark = 0x3f3f3f, //r:3f , g: 3f, b: 3f, i: 1f
@@ -617,9 +633,19 @@ enum eGameHostOption
eGameHostOption_HostCanBeInvisible,
eGameHostOption_BedrockFog,
eGameHostOption_NoHUD,
eGameHostOption_WorldSize,
eGameHostOption_All,
eGameHostOption_DisableSaving,
eGameHostOption_WasntSaveOwner, // Added for PS3 save transfer, so we can add a nice message in the future instead of the creative mode one
eGameHostOption_MobGriefing,
eGameHostOption_KeepInventory,
eGameHostOption_DoMobSpawning,
eGameHostOption_DoMobLoot,
eGameHostOption_DoTileDrops,
eGameHostOption_NaturalRegeneration,
eGameHostOption_DoDaylightCycle,
};
// 4J-PB - If any new DLC items are added to the TMSFiles, this array needs updated
@@ -639,6 +665,8 @@ enum _TMSFILES
TMS_SPM,
TMS_SPI,
TMS_SPG,
TMS_SPD1,
TMS_SPSW1,
TMS_THST,
TMS_THIR,
@@ -748,6 +776,8 @@ enum _TMSFILES
TMS_MPSR_DAT,
TMS_MPHA,
TMS_MPHA_DAT,
TMS_MPFE,
TMS_MPFE_DAT,
TMS_TP01,
TMS_TP01_DAT,
@@ -761,6 +791,8 @@ enum _TMSFILES
TMS_TP06_DAT,
TMS_TP07,
TMS_TP07_DAT,
TMS_TP08,
TMS_TP08_DAT,
TMS_COUNT
};
@@ -875,7 +907,7 @@ enum eMCLang
eMCLang_plPL,
eMCLang_trTR,
eMCLang_elEL,
eMCLang_zhCHS,
eMCLang_csCS,
eMCLang_zhCHT,
eMCLang_laLAS,
@@ -910,4 +942,7 @@ enum eMCLang
eMCLang_elGR,
eMCLang_nnNO,
eMCLang_skSK,
eMCLang_hans,
eMCLang_hant,
};

View File

@@ -100,6 +100,10 @@ typedef struct
// PS3 1.05 - Adding Greek, so need a language
unsigned char ucLanguage;
// 29/Oct/2014 - Language selector.
unsigned char ucLocale;
// 4J Stu - See comment for GAME_SETTINGS_PROFILE_DATA_BYTES below
// was 192
//unsigned char ucUnused[192-TUTORIAL_PROFILE_STORAGE_BYTES-sizeof(DWORD)-sizeof(char)-sizeof(char)-sizeof(char)-sizeof(char)-sizeof(LONG)-sizeof(LONG)-sizeof(DWORD)];

View File

@@ -35,4 +35,43 @@ void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal)
m_bIsPlayingNetherMusic=bVal;
}
void ConsoleSoundEngine::tick()
{
if (scheduledSounds.empty())
{
return;
}
for(AUTO_VAR(it,scheduledSounds.begin()); it != scheduledSounds.end();)
{
SoundEngine::ScheduledSound *next = *it;
next->delay--;
if (next->delay <= 0)
{
play(next->iSound, next->x, next->y, next->z, next->volume, next->pitch);
it =scheduledSounds.erase(it);
delete next;
}
else
{
++it;
}
}
}
void ConsoleSoundEngine::schedule(int iSound, float x, float y, float z, float volume, float pitch, int delayTicks)
{
scheduledSounds.push_back(new SoundEngine::ScheduledSound(iSound, x, y, z, volume, pitch, delayTicks));
}
ConsoleSoundEngine::ScheduledSound::ScheduledSound(int iSound, float x, float y, float z, float volume, float pitch, int delay)
{
this->iSound = iSound;
this->x = x;
this->y = y;
this->z = z;
this->volume = volume;
this->pitch = pitch;
this->delay = delay;
}

View File

@@ -69,6 +69,25 @@ public:
static const WCHAR *wchSoundNames[eSoundType_MAX];
static const WCHAR *wchUISoundNames[eSFX_MAX];
public:
void tick();
void schedule(int iSound, float x, float y, float z, float volume, float pitch, int delayTicks);
private:
class ScheduledSound
{
public:
int iSound;
float x, y, z;
float volume, pitch;
int delay;
public:
ScheduledSound(int iSound, float x, float y, float z, float volume, float pitch, int delay);
};
vector<ScheduledSound *> scheduledSounds;
private:
// platform specific functions

View File

@@ -490,6 +490,12 @@ void SoundEngine::updateMiles()
case eSoundType_MOB_ENDERDRAGON_HIT:
distanceScaler=100.0f;
break;
case eSoundType_FIREWORKS_BLAST:
case eSoundType_FIREWORKS_BLAST_FAR:
case eSoundType_FIREWORKS_LARGE_BLAST:
case eSoundType_FIREWORKS_LARGE_BLAST_FAR:
distanceScaler=100.0f;
break;
case eSoundType_MOB_GHAST_MOAN:
case eSoundType_MOB_GHAST_SCREAM:
case eSoundType_MOB_GHAST_DEATH:
@@ -624,6 +630,7 @@ static S32 running = AIL_ms_count();
void SoundEngine::tick(shared_ptr<Mob> *players, float a)
{
ConsoleSoundEngine::tick();
#ifdef __DISABLE_MILES__
return;
#endif
@@ -1129,6 +1136,11 @@ int SoundEngine::OpenStreamThreadProc( void* lpParameter )
#endif
SoundEngine *soundEngine = (SoundEngine *)lpParameter;
soundEngine->m_hStream = AIL_open_stream(soundEngine->m_hDriver,soundEngine->m_szStreamName,0);
if(soundEngine->m_hStream==0)
{
app.DebugPrintf("SoundEngine::OpenStreamThreadProc - Could not open - %s\n",soundEngine->m_szStreamName);
}
return 0;
}
@@ -1225,7 +1237,11 @@ void SoundEngine::playMusicUpdate()
char szName[255];
wcstombs(szName,wstrSoundName.c_str(),255);
#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__
string strFile="TPACK:/Data/" + string(szName) + ".binka";
#else
string strFile="TPACK:\\Data\\" + string(szName) + ".binka";
#endif
std::string mountedPath = StorageManager.GetMountedPath(strFile);
strcpy(m_szStreamName,mountedPath.c_str());
#endif

View File

@@ -151,6 +151,78 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
L"dig.snow", // eSoundType_DIG_SNOW
L"dig.stone", // eSoundType_DIG_STONE
L"dig.wood", // eSoundType_DIG_WOOD
// 1.6.4
L"fireworks.launch", //eSoundType_FIREWORKS_LAUNCH,
L"fireworks.blast", //eSoundType_FIREWORKS_BLAST,
L"fireworks.blast_far", //eSoundType_FIREWORKS_BLAST_FAR,
L"fireworks.large_blast", //eSoundType_FIREWORKS_LARGE_BLAST,
L"fireworks.large_blast_far", //eSoundType_FIREWORKS_LARGE_BLAST_FAR,
L"fireworks.twinkle", //eSoundType_FIREWORKS_TWINKLE,
L"fireworks.twinkle_far", //eSoundType_FIREWORKS_TWINKLE_FAR,
L"mob.bat.idle", //eSoundType_MOB_BAT_IDLE,
L"mob.bat.hurt", //eSoundType_MOB_BAT_HURT,
L"mob.bat.death", //eSoundType_MOB_BAT_DEATH,
L"mob.bat.takeoff", //eSoundType_MOB_BAT_TAKEOFF,
L"mob.wither.spawn", //eSoundType_MOB_WITHER_SPAWN,
L"mob.wither.idle", //eSoundType_MOB_WITHER_IDLE,
L"mob.wither.hurt", //eSoundType_MOB_WITHER_HURT,
L"mob.wither.death", //eSoundType_MOB_WITHER_DEATH,
L"mob.wither.shoot", //eSoundType_MOB_WITHER_SHOOT,
L"mob.cow.step", //eSoundType_MOB_COW_STEP,
L"mob.chicken.step", //eSoundType_MOB_CHICKEN_STEP,
L"mob.pig.step", //eSoundType_MOB_PIG_STEP,
L"mob.enderman.stare", //eSoundType_MOB_ENDERMAN_STARE,
L"mob.enderman.scream", //eSoundType_MOB_ENDERMAN_SCREAM,
L"mob.sheep.shear", //eSoundType_MOB_SHEEP_SHEAR,
L"mob.sheep.step", //eSoundType_MOB_SHEEP_STEP,
L"mob.skeleton.death", //eSoundType_MOB_SKELETON_DEATH,
L"mob.skeleton.step", //eSoundType_MOB_SKELETON_STEP,
L"mob.spider.step", //eSoundType_MOB_SPIDER_STEP,
L"mob.wolf.step", //eSoundType_MOB_WOLF_STEP,
L"mob.zombie.step", //eSoundType_MOB_ZOMBIE_STEP,
L"liquid.swim", //eSoundType_LIQUID_SWIM,
L"mob.horse.land", //eSoundType_MOB_HORSE_LAND,
L"mob.horse.armor", //eSoundType_MOB_HORSE_ARMOR,
L"mob.horse.leather", //eSoundType_MOB_HORSE_LEATHER,
L"mob.horse.zombie.death", //eSoundType_MOB_HORSE_ZOMBIE_DEATH,
L"mob.horse.skeleton.death", //eSoundType_MOB_HORSE_SKELETON_DEATH,
L"mob.horse.donkey.death", //eSoundType_MOB_HORSE_DONKEY_DEATH,
L"mob.horse.death", //eSoundType_MOB_HORSE_DEATH,
L"mob.horse.zombie.hit", //eSoundType_MOB_HORSE_ZOMBIE_HIT,
L"mob.horse.skeleton.hit", //eSoundType_MOB_HORSE_SKELETON_HIT,
L"mob.horse.donkey.hit", //eSoundType_MOB_HORSE_DONKEY_HIT,
L"mob.horse.hit", //eSoundType_MOB_HORSE_HIT,
L"mob.horse.zombie.idle", //eSoundType_MOB_HORSE_ZOMBIE_IDLE,
L"mob.horse.skeleton.idle", //eSoundType_MOB_HORSE_SKELETON_IDLE,
L"mob.horse.donkey.idle", //eSoundType_MOB_HORSE_DONKEY_IDLE,
L"mob.horse.idle", //eSoundType_MOB_HORSE_IDLE,
L"mob.horse.donkey.angry", //eSoundType_MOB_HORSE_DONKEY_ANGRY,
L"mob.horse.angry", //eSoundType_MOB_HORSE_ANGRY,
L"mob.horse.gallop", //eSoundType_MOB_HORSE_GALLOP,
L"mob.horse.breathe", //eSoundType_MOB_HORSE_BREATHE,
L"mob.horse.wood", //eSoundType_MOB_HORSE_WOOD,
L"mob.horse.soft", //eSoundType_MOB_HORSE_SOFT,
L"mob.horse.jump", //eSoundType_MOB_HORSE_JUMP,
L"mob.witch.idle", //eSoundType_MOB_WITCH_IDLE, <--- missing
L"mob.witch.hurt", //eSoundType_MOB_WITCH_HURT, <--- missing
L"mob.witch.death", //eSoundType_MOB_WITCH_DEATH, <--- missing
L"mob.slime.big", //eSoundType_MOB_SLIME_BIG,
L"mob.slime.small", //eSoundType_MOB_SLIME_SMALL,
L"eating", //eSoundType_EATING <--- missing
L"random.levelup", //eSoundType_RANDOM_LEVELUP
// 4J-PB - Some sounds were updated, but we can't do that for the 360 or we have to do a new sound bank
// instead, we'll add the sounds as new ones and change the code to reference them
L"fire.new_ignite",
};

View File

@@ -7,14 +7,14 @@
// This goes up with each build
// 4J-JEV: This value is extracted with a regex so it can be placed as the version in the AppX manifest on Durango.
#define VER_PRODUCTBUILD 495
#define VER_PRODUCTBUILD 560
// This goes up if there is any change to network traffic or code in a build
#define VER_NETWORK 495
#define VER_NETWORK 560
#define VER_PRODUCTBUILD_QFE 0
#define VER_FILEVERSION_STRING "1.3"
#define VER_FILEVERSION_STRING "1.6"
#define VER_PRODUCTVERSION_STRING VER_FILEVERSION_STRING
#define VER_FILEVERSION_STRING_W L"1.3"
#define VER_FILEVERSION_STRING_W L"1.6"
#define VER_PRODUCTVERSION_STRING_W VER_FILEVERSION_STRING_W
#define VER_FILEBETA_STR ""
#undef VER_FILEVERSION

View File

@@ -201,6 +201,10 @@ wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] =
L"Effect_Hunger",
L"Effect_Weakness",
L"Effect_Poison",
L"Effect_Wither",
L"Effect_HealthBoost",
L"Effect_Absorption",
L"Effect_Saturation",
L"Potion_BaseColour",
@@ -246,6 +250,12 @@ wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] =
L"Mob_Ocelot_Colour2",
L"Mob_Villager_Colour1",
L"Mob_Villager_Colour2",
L"Mob_Bat_Colour1",
L"Mob_Bat_Colour2",
L"Mob_Witch_Colour1",
L"Mob_Witch_Colour2",
L"Mob_Horse_Colour1",
L"Mob_Horse_Colour2",
L"Armour_Default_Leather_Colour",
L"Under_Water_Clear_Colour",
@@ -262,6 +272,11 @@ wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] =
L"Sign_Text",
L"Map_Text",
L"Leash_Light_Colour",
L"Leash_Dark_Colour",
L"Fire_Overlay",
L"HTMLColor_0",
L"HTMLColor_1",

View File

@@ -12,15 +12,15 @@ enum eDebugSetting
eDebugSetting_CraftAnything,
eDebugSetting_UseDpadForDebug,
eDebugSetting_MobsDontTick,
eDebugSetting_InstantDestroy,
eDebugSetting_ArtTools, //eDebugSetting_InstantDestroy,
eDebugSetting_ShowUIConsole,
eDebugSetting_DistributableSave,
eDebugSetting_DebugLeaderboards,
eDebugSetting_EnableHeightWaterBiomeOverride, //eDebugSetting_TipsAlwaysOn,
eDebugSetting_EnableHeightWaterOverride, //eDebugSetting_TipsAlwaysOn,
eDebugSetting_SuperflatNether,
//eDebugSetting_LightDarkBackground,
eDebugSetting_RegularLightning,
eDebugSetting_GoToNether,
eDebugSetting_EnableBiomeOverride, //eDebugSetting_GoToNether,
//eDebugSetting_GoToEnd,
eDebugSetting_GoToOverworld,
eDebugSetting_UnlockAllDLC, // eDebugSetting_ToggleFont,

File diff suppressed because it is too large Load Diff

View File

@@ -39,6 +39,11 @@ class Container;
class DispenserTileEntity;
class SignTileEntity;
class BrewingStandTileEntity;
class CommandBlockEntity;
class HopperTileEntity;
class MinecartHopper;
class EntityHorse;
class BeaconTileEntity;
class LocalPlayer;
class DLCPack;
class LevelRuleset;
@@ -87,9 +92,9 @@ public:
#ifdef _EXTENDED_ACHIEVEMENTS
/* 4J-JEV:
* We need more space in the profile data because of the new achievements and statistics
* necessary for the new expanded achievement set.
*/
* 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
#else
static const int GAME_DEFINED_PROFILE_DATA_BYTES = 972; // per user
@@ -108,7 +113,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;}
@@ -127,23 +132,30 @@ public:
int GetLocalPlayerCount(void);
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 LoadEnchantingMenu(int iPad,shared_ptr<Inventory> inventory, int x, int y, int z, Level *level, const wstring &name);
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 LoadFireworksMenu(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 LoadTradingMenu(int iPad, shared_ptr<Inventory> inventory, shared_ptr<Merchant> trader, Level *level, const wstring &name);
bool LoadCommandBlockMenu(int iPad, shared_ptr<CommandBlockEntity> commandBlock) { return false; }
bool LoadHopperMenu(int iPad ,shared_ptr<Inventory> inventory, shared_ptr<HopperTileEntity> hopper);
bool LoadHopperMenu(int iPad ,shared_ptr<Inventory> inventory, shared_ptr<MinecartHopper> hopper);
bool LoadHorseMenu(int iPad ,shared_ptr<Inventory> inventory, shared_ptr<Container> container, shared_ptr<EntityHorse> horse);
bool LoadBeaconMenu(int iPad ,shared_ptr<Inventory> inventory, shared_ptr<BeaconTileEntity> beacon);
bool GetTutorialMode() { return m_bTutorialMode;}
void SetTutorialMode(bool bSet) {m_bTutorialMode=bSet;}
void SetSpecialTutorialCompletionFlag(int iPad, int index);
static LPCWSTR GetString(int iID);
static LPCWSTR GetString(int iID);
eGameMode GetGameMode() { return m_eGameMode;}
void SetGameMode(eGameMode eMode) { m_eGameMode=eMode;}
@@ -159,7 +171,7 @@ public:
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; }
@@ -206,6 +218,7 @@ public:
static int OldProfileVersionCallback(LPVOID pParam,unsigned char *pucData, const unsigned short usVersion, const int iPad);
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ )
wstring toStringOptionsStatus(const C4JStorage::eOptionsCallback &eStatus);
static int DefaultOptionsCallback(LPVOID pParam,C4JStorage::PROFILESETTINGS *pSettings, const int iPad);
int SetDefaultOptions(C4JStorage::PROFILESETTINGS *pSettings,const int iPad,bool bWriteProfile=true);
#ifdef __ORBIS__
@@ -224,7 +237,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
@@ -247,7 +260,8 @@ public:
// Minecraft language select
void SetMinecraftLanguage(int iPad, unsigned char ucLanguage);
unsigned char GetMinecraftLanguage(int iPad);
void SetMinecraftLocale(int iPad, unsigned char ucLanguage);
unsigned char GetMinecraftLocale(int iPad);
// 4J-PB - set a timer when the user navigates the quickselect, so we can bring the opacity back to defaults for a short time
unsigned int GetOpacityTimer(int iPad) { return m_uiOpacityCountDown[iPad]; }
@@ -301,9 +315,11 @@ public:
#endif
#ifdef _DEBUG_MENUS_ENABLED
bool DebugSettingsOn() { return m_bDebugOptions;}
bool DebugSettingsOn() { return m_bDebugOptions;}
bool DebugArtToolsOn();
#else
bool DebugSettingsOn() { return false;}
bool DebugSettingsOn() { return false;}
bool DebugArtToolsOn() { return false;}
#endif
void SetDebugSequence(const char *pchSeq);
static int DebugInputCallback(LPVOID pParam);
@@ -424,10 +440,10 @@ 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];
void HandleButtonPresses(int iPad);
@@ -440,7 +456,7 @@ private:
// Container scene for some menu
// CXuiScene debugContainerScene;
// CXuiScene debugContainerScene;
//bool m_bSplitScreenEnabled;
@@ -482,14 +498,14 @@ public:
static const DWORD m_dwOfferID = 0x00000001;
// timer
// timer
void InitTime();
void UpdateTime();
// trial timer
void SetTrialTimerStart(void);
float getTrialTimer(void);
// notifications from the game for qnet
VNOTIFICATIONS *GetNotifications() {return &m_vNotifications;}
@@ -599,7 +615,7 @@ public:
unsigned int GetDLCCreditsCount();
SCreditTextItemDef * GetDLCCredits(int iIndex);
// TMS
// TMS
void ReadDLCFileFromTMS(int iPad,eTMSAction action, bool bCallback=false);
void ReadXuidsFileFromTMS(int iPad,eTMSAction action,bool bCallback=false);
@@ -633,8 +649,8 @@ private:
static unordered_map<ULONGLONG,DLC_INFO * > DLCInfo_Full; // full offerid, dlc_info
static unordered_map<wstring, ULONGLONG > DLCInfo_SkinName; // skin name, full offer id
#endif
// bool m_bRead_TMS_XUIDS_XML; // track whether we have already read the TMS xuids.xml file
// bool m_bRead_TMS_DLCINFO_XML; // track whether we have already read the TMS DLC.xml file
// bool m_bRead_TMS_XUIDS_XML; // track whether we have already read the TMS xuids.xml file
// bool m_bRead_TMS_DLCINFO_XML; // track whether we have already read the TMS DLC.xml file
bool m_bDefaultCapeInstallAttempted; // have we attempted to install the default cape from tms
@@ -651,13 +667,13 @@ public:
XUSER_SIGNIN_INFO m_currentSigninInfo[XUSER_MAX_COUNT];
//void OverrideFontRenderer(bool set, bool immediate = true);
// void ToggleFontRenderer() { OverrideFontRenderer(!m_bFontRendererOverridden,false); }
// void ToggleFontRenderer() { OverrideFontRenderer(!m_bFontRendererOverridden,false); }
BANNEDLIST BannedListA[XUSER_MAX_COUNT];
private:
// XUI_FontRenderer *m_fontRenderer;
// bool m_bFontRendererOverridden;
// bool m_bOverrideFontRenderer;
// XUI_FontRenderer *m_fontRenderer;
// bool m_bFontRendererOverridden;
// bool m_bOverrideFontRenderer;
bool m_bRead_BannedListA[XUSER_MAX_COUNT];
@@ -667,7 +683,7 @@ private:
public:
void SetBanListCheck(int iPad,bool bVal) {m_BanListCheck[iPad]=bVal;}
bool GetBanListCheck(int iPad) { return m_BanListCheck[iPad];}
// AUTOSAVE
// AUTOSAVE
public:
void SetAutosaveTimerTime(void);
bool AutosaveDue(void);
@@ -685,6 +701,11 @@ private:
unsigned int m_uiGameHostSettings;
static unsigned char m_szPNG[8];
#ifdef _LARGE_WORLDS
unsigned int m_GameNewWorldSize;
bool m_bGameNewWorldSizeUseMoat;
unsigned int m_GameNewHellScale;
#endif
unsigned int FromBigEndian(unsigned int uiValue);
public:
@@ -695,6 +716,13 @@ public:
unsigned int GetGameHostOption(eGameHostOption eVal);
unsigned int GetGameHostOption(unsigned int uiHostSettings, eGameHostOption eVal);
#ifdef _LARGE_WORLDS
void SetGameNewWorldSize(unsigned int newSize, bool useMoat) { m_GameNewWorldSize = newSize; m_bGameNewWorldSizeUseMoat = useMoat; }
unsigned int GetGameNewWorldSize() { return m_GameNewWorldSize; }
unsigned int GetGameNewWorldSizeUseMoat() { return m_bGameNewWorldSizeUseMoat; }
void SetGameNewHellScale(unsigned int newScale) { m_GameNewHellScale = newScale; }
unsigned int GetGameNewHellScale() { return m_GameNewHellScale; }
#endif
void SetResetNether(bool bResetNether) {m_bResetNether=bResetNether;}
bool GetResetNether() {return m_bResetNether;}
bool CanRecordStatsAndAchievements();
@@ -808,9 +836,9 @@ public:
DWORD m_dwDLCFileSize;
BYTE *m_pDLCFileBuffer;
// static int CallbackReadXuidsFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction);
// static int CallbackDLCFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction);
// static int CallbackBannedListFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction);
// static int CallbackReadXuidsFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction);
// static int CallbackDLCFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction);
// static int CallbackBannedListFileFromTMS(LPVOID lpParam, WCHAR *wchFilename, int iPad, bool bResult, int iAction);
// Storing additional model parts per skin texture
void SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, DWORD dwSkinBoxC);
@@ -875,27 +903,27 @@ public:
void SetTickTMSDLCFiles(bool bVal);
wstring getFilePath(DWORD packId, wstring filename, bool bAddDataFolder);
wstring getFilePath(DWORD packId, wstring filename, bool bAddDataFolder, wstring mountPoint = L"TPACK:");
private:
unordered_map<int, wstring>m_localeA;
unordered_map<wstring, int>m_eMCLangA;
unordered_map<wstring, int>m_xcLangA;
wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder);
unordered_map<int, wstring>m_localeA;
unordered_map<wstring, int>m_eMCLangA;
unordered_map<wstring, int>m_xcLangA;
wstring getRootPath(DWORD packId, bool allowOverride, bool bAddDataFolder, wstring mountPoint);
public:
#ifdef _XBOX
// bool m_bTransferSavesToXboxOne;
// unsigned int m_uiTransferSlotC;
// bool m_bTransferSavesToXboxOne;
// unsigned int m_uiTransferSlotC;
#elif defined (__PS3__)
#elif defined _DURANGO
#elif defined _WINDOWS64
//CMinecraftAudio audio;
#else // PS4
#endif
#ifdef _XBOX_ONE

View File

@@ -91,6 +91,28 @@ void DLCManager::removePack(DLCPack *pack)
}
}
void DLCManager::removeAllPacks(void)
{
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
{
DLCPack *pack = (DLCPack *)*it;
delete pack;
}
m_packs.clear();
}
void DLCManager::LanguageChanged(void)
{
for(AUTO_VAR(it, m_packs.begin()); it != m_packs.end(); ++it)
{
DLCPack *pack = (DLCPack *)*it;
// update the language
pack->UpdateLanguage();
}
}
DLCPack *DLCManager::getPack(const wstring &name)
{
DLCPack *pack = NULL;
@@ -292,12 +314,12 @@ DWORD DLCManager::checkForCorruptDLCAndAlert(bool showMessage /*= true*/)
WCHAR wchFormat[132];
swprintf(wchFormat, 132, L"%ls\n\n%%ls", firstCorruptPack->getName().c_str());
C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable(),wchFormat);
C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL,wchFormat);
}
else
{
C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC_MULTIPLE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable());
C4JStorage::EMessageResult result = ui.RequestErrorMessage( IDS_CORRUPT_DLC_TITLE, IDS_CORRUPT_DLC_MULTIPLE, uiIDA,1,ProfileManager.GetPrimaryPad());
}
}

View File

@@ -74,6 +74,8 @@ public:
void addPack(DLCPack *pack);
void removePack(DLCPack *pack);
void removeAllPacks(void);
void LanguageChanged(void);
DLCPack *getPack(const wstring &name);
#ifdef _XBOX_ONE

View File

@@ -191,7 +191,8 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
{
case DLCManager::e_DLCType_Skin:
{
std::vector<std::wstring> splitPath = stringSplit(path,L'/');
wstring newPath = replaceAll(path, L"\\", L"/");
std::vector<std::wstring> splitPath = stringSplit(newPath,L'/');
wstring strippedPath = splitPath.back();
newFile = new DLCSkinFile(strippedPath);
@@ -211,7 +212,8 @@ DLCFile *DLCPack::addFile(DLCManager::EDLCType type, const wstring &path)
break;
case DLCManager::e_DLCType_Cape:
{
std::vector<std::wstring> splitPath = stringSplit(path,L'/');
wstring newPath = replaceAll(path, L"\\", L"/");
std::vector<std::wstring> splitPath = stringSplit(newPath,L'/');
wstring strippedPath = splitPath.back();
newFile = new DLCCapeFile(strippedPath);
}
@@ -411,3 +413,19 @@ bool DLCPack::hasPurchasedFile(DLCManager::EDLCType type, const wstring &path)
return true;
}*/
}
void DLCPack::UpdateLanguage()
{
// find the language file
DLCManager::e_DLCType_LocalisationData;
DLCFile *file = NULL;
if(m_files[DLCManager::e_DLCType_LocalisationData].size() > 0)
{
file = m_files[DLCManager::e_DLCType_LocalisationData][0];
DLCLocalisationFile *localisationFile = (DLCLocalisationFile *)getFile(DLCManager::e_DLCType_LocalisationData, L"languages.loc");
StringTable *strTable = localisationFile->getStringTable();
strTable->ReloadStringTable();
}
}

View File

@@ -68,6 +68,8 @@ public:
DWORD getLicenseMask( ) { return m_dwLicenseMask; }
wstring getName() { return m_packName; }
void UpdateLanguage();
#ifdef _XBOX_ONE
wstring getPurchaseOfferId() { return m_wsProductId; }
#else

View File

@@ -30,6 +30,7 @@ void DLCTextureFile::addParameter(DLCManager::EDLCParameterType type, const wstr
{
case DLCManager::e_DLCParamType_Anim:
m_animString = value;
if(m_animString.empty()) m_animString = L",";
m_bIsAnim = true;
break;

View File

@@ -35,4 +35,8 @@ public:
bool checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1);
virtual int getMinY();
EStructurePiece GetType() { return (EStructurePiece)0; }
void addAdditonalSaveData(CompoundTag *tag) {}
void readAdditonalSaveData(CompoundTag *tag) {}
};

View File

@@ -278,7 +278,7 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
//{
// if(blockData[i] == Tile::sand_Id || blockData[i] == Tile::sandStone_Id)
// {
// blockData[i] = Tile::whiteStone_Id;
// blockData[i] = Tile::endStone_Id;
// }
//}
@@ -706,15 +706,19 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
shared_ptr<Entity> e = *it;
bool mobCanBeSaved = false;
if(bSaveMobs)
if (bSaveMobs)
{
if( ( e->GetType() & eTYPE_MONSTER ) || ( e->GetType() & eTYPE_WATERANIMAL ) || ( e->GetType() & eTYPE_ANIMAL ) ||
( e->GetType() == eTYPE_CHICKEN ) || ( e->GetType() == eTYPE_WOLF ) || ( e->GetType() == eTYPE_VILLAGER) || ( e->GetType() == eTYPE_MUSHROOMCOW ) )
if ( e->instanceof(eTYPE_MONSTER) || e->instanceof(eTYPE_WATERANIMAL) || e->instanceof(eTYPE_ANIMAL) || (e->GetType() == eTYPE_VILLAGER) )
// 4J-JEV: All these are derived from eTYPE_ANIMAL and true implicitly.
//|| ( e->GetType() == eTYPE_CHICKEN ) || ( e->GetType() == eTYPE_WOLF ) || ( e->GetType() == eTYPE_MUSHROOMCOW ) )
{
mobCanBeSaved = true;
}
}
if(mobCanBeSaved || e->GetType() == eTYPE_MINECART || e->GetType() == eTYPE_BOAT || e->GetType() == eTYPE_PAINTING || e->GetType() == eTYPE_ITEM_FRAME)
// 4J-JEV: Changed to check for instances of minecarts and hangingEntities instead of just eTYPE_PAINTING, eTYPE_ITEM_FRAME and eTYPE_MINECART
if (mobCanBeSaved || e->instanceof(eTYPE_MINECART) || e->GetType() == eTYPE_BOAT || e->instanceof(eTYPE_HANGING_ENTITY))
{
CompoundTag *eTag = new CompoundTag();
if( e->save(eTag) )
@@ -725,7 +729,7 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
pos->get(1)->data -= yStart;
pos->get(2)->data -= zStart;
if( e->GetType() == eTYPE_PAINTING || e->GetType() == eTYPE_ITEM_FRAME )
if( e->instanceof(eTYPE_HANGING_ENTITY) )
{
((IntTag *) eTag->get(L"TileX") )->data -= xStart;
((IntTag *) eTag->get(L"TileY") )->data -= yStart;

View File

@@ -106,17 +106,14 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
DWORD dSize;
byte *dData = dlcHeader->getData(dSize);
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(pack);
// = loadGameRules(dData, dSize); //, strings);
createdLevelGenerationOptions->setGrSource( dlcHeader );
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_fromDLC );
readRuleFile(createdLevelGenerationOptions, dData, dSize, strings);
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_fromDLC );
//createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_fromDLC );
dlcHeader->lgo = createdLevelGenerationOptions;
}
@@ -128,15 +125,13 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
DWORD dSize;
byte *dData = dlcFile->getData(dSize);
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(pack);
// = loadGameRules(dData, dSize); //, strings);
createdLevelGenerationOptions->setGrSource( new JustGrSource() );
readRuleFile(createdLevelGenerationOptions, dData, dSize, strings);
createdLevelGenerationOptions->setSrc( LevelGenerationOptions::eSrc_tutorial );
//createdLevelGenerationOptions->set_DLCGameRulesFile( dlcFile );
readRuleFile(createdLevelGenerationOptions, dData, dSize, strings);
createdLevelGenerationOptions->setLoadedData();
}
@@ -659,6 +654,25 @@ void GameRuleManager::loadDefaultGameRules()
#else // _XBOX
#ifdef _WINDOWS64
File packedTutorialFile(L"Windows64Media\\Tutorial\\Tutorial.pck");
if(!packedTutorialFile.exists()) packedTutorialFile = File(L"Windows64\\Tutorial\\Tutorial.pck");
#elif defined(__ORBIS__)
File packedTutorialFile(L"/app0/orbis/Tutorial/Tutorial.pck");
#elif defined(__PSVITA__)
File packedTutorialFile(L"PSVita/Tutorial/Tutorial.pck");
#elif defined(__PS3__)
File packedTutorialFile(L"PS3/Tutorial/Tutorial.pck");
#else
File packedTutorialFile(L"Tutorial\\Tutorial.pck");
#endif
if(loadGameRulesPack(&packedTutorialFile))
{
m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL));
//m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(L"Tutorial");
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME));
}
#if 0
wstring fpTutorial = L"Tutorial.pck";
if(app.getArchiveFileSize(fpTutorial) >= 0)
{
@@ -667,25 +681,18 @@ void GameRuleManager::loadDefaultGameRules()
if ( app.m_dlcManager.readDLCDataFile(dwFilesProcessed,fpTutorial,pack,true) )
{
app.m_dlcManager.addPack(pack);
m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL));
m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME));
//m_levelGenerators.getLevelGenerators()->at(0)->setWorldName(app.GetString(IDS_PLAY_TUTORIAL));
//m_levelGenerators.getLevelGenerators()->at(0)->setDefaultSaveName(app.GetString(IDS_TUTORIALSAVENAME));
}
else delete pack;
}
/*StringTable *strings = new StringTable(baStrings.data, baStrings.length);
LevelGenerationOptions *lgo = new LevelGenerationOptions();
lgo->setGrSource( new JustGrSource() );
lgo->setSrc( LevelGenerationOptions::eSrc_tutorial );
readRuleFile(lgo, tutorial.data, tutorial.length, strings);
lgo->setLoadedData();*/
#endif
#endif
}
bool GameRuleManager::loadGameRulesPack(File *path)
{
bool success = false;
#ifdef _XBOX
if(path->exists())
{
DLCPack *pack = new DLCPack(L"",0xffffffff);
@@ -700,12 +707,13 @@ bool GameRuleManager::loadGameRulesPack(File *path)
delete pack;
}
}
#endif
return success;
}
void GameRuleManager::setLevelGenerationOptions(LevelGenerationOptions *levelGen)
{
unloadCurrentGameRules();
m_currentGameRuleDefinitions = NULL;
m_currentLevelGenerationOptions = levelGen;

View File

@@ -7,6 +7,7 @@
#include "..\..\..\Minecraft.World\net.minecraft.world.phys.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.level.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.level.chunk.h"
#include "Common\DLC\DLCGameRulesHeader.h"
#include "..\..\StringTable.h"
#include "LevelGenerationOptions.h"
#include "ConsoleGameRules.h"
@@ -41,7 +42,7 @@ void JustGrSource::setBaseSavePath(const wstring &x) { m_baseSavePath = x; m_bRe
bool JustGrSource::ready() { return true; }
LevelGenerationOptions::LevelGenerationOptions()
LevelGenerationOptions::LevelGenerationOptions(DLCPack *parentPack)
{
m_spawnPos = NULL;
m_stringTable = NULL;
@@ -49,6 +50,7 @@ LevelGenerationOptions::LevelGenerationOptions()
m_hasLoadedData = false;
m_seed = 0;
m_bHasBeenInCreative = true;
m_useFlatWorld = false;
m_bHaveMinY = false;
m_minY = INT_MAX;
@@ -56,6 +58,9 @@ LevelGenerationOptions::LevelGenerationOptions()
m_pbBaseSaveData = NULL;
m_dwBaseSaveSize = 0;
m_parentDLCPack = parentPack;
m_bLoadingData = false;
}
LevelGenerationOptions::~LevelGenerationOptions()
@@ -70,17 +75,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 +98,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 +115,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++)
@@ -190,24 +195,24 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
{
if(attributeValue.compare(L"true") == 0) m_useFlatWorld = true;
app.DebugPrintf("LevelGenerationOptions: Adding parameter flatworld=%s\n",m_useFlatWorld?"TRUE":"FALSE");
}
}
else if(attributeName.compare(L"saveName") == 0)
{
wstring string(getString(attributeValue));
wstring string(attributeValue);
if(!string.empty()) setDefaultSaveName( string );
else setDefaultSaveName( attributeValue );
app.DebugPrintf("LevelGenerationOptions: Adding parameter saveName=%ls\n", getDefaultSaveName().c_str());
}
else if(attributeName.compare(L"worldName") == 0)
{
wstring string(getString(attributeValue));
wstring string(attributeValue);
if(!string.empty()) setWorldName( string );
else setWorldName( attributeValue );
app.DebugPrintf("LevelGenerationOptions: Adding parameter worldName=%ls\n", getWorldName());
}
else if(attributeName.compare(L"displayName") == 0)
{
wstring string(getString(attributeValue));
wstring string(attributeValue);
if(!string.empty()) setDisplayName( string );
else setDisplayName( attributeValue );
app.DebugPrintf("LevelGenerationOptions: Adding parameter displayName=%ls\n", getDisplayName());
@@ -228,6 +233,12 @@ void LevelGenerationOptions::addAttribute(const wstring &attributeName, const ws
setBaseSavePath( attributeValue );
app.DebugPrintf("LevelGenerationOptions: Adding parameter baseSaveName=%ls\n", getBaseSavePath().c_str());
}
else if(attributeName.compare(L"hasBeenInCreative") == 0)
{
bool value = _fromString<bool>(attributeValue);
m_bHasBeenInCreative = value;
app.DebugPrintf("LevelGenerationOptions: Adding parameter gameMode=%d\n", m_bHasBeenInCreative);
}
else
{
GameRuleDefinition::addAttribute(attributeName, attributeValue);
@@ -297,7 +308,7 @@ bool LevelGenerationOptions::checkIntersects(int x0, int y0, int z0, int x1, int
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;
@@ -413,14 +424,14 @@ void LevelGenerationOptions::getBiomeOverride(int biomeId, BYTE &tile, BYTE &top
}
}
bool LevelGenerationOptions::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature)
bool LevelGenerationOptions::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation)
{
bool isFeature = false;
for(AUTO_VAR(it, m_features.begin()); it != m_features.end(); ++it)
{
StartFeature *sf = *it;
if(sf->isFeatureChunk(chunkX, chunkZ, feature))
if(sf->isFeatureChunk(chunkX, chunkZ, feature, orientation))
{
isFeature = true;
break;
@@ -442,15 +453,175 @@ unordered_map<wstring, ConsoleSchematicFile *> *LevelGenerationOptions::getUnfin
= 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;
}
void LevelGenerationOptions::loadBaseSaveData()
{
int mountIndex = -1;
if(m_parentDLCPack != NULL) mountIndex = m_parentDLCPack->GetDLCMountIndex();
if(mountIndex > -1)
{
#ifdef _DURANGO
if(StorageManager.MountInstalledDLC(ProfileManager.GetPrimaryPad(),mountIndex,&LevelGenerationOptions::packMounted,this,L"WPACK")!=ERROR_IO_PENDING)
#else
if(StorageManager.MountInstalledDLC(ProfileManager.GetPrimaryPad(),mountIndex,&LevelGenerationOptions::packMounted,this,"WPACK")!=ERROR_IO_PENDING)
#endif
{
// corrupt DLC
setLoadedData();
app.DebugPrintf("Failed to mount LGO DLC %d for pad %d\n",mountIndex,ProfileManager.GetPrimaryPad());
}
else
{
m_bLoadingData = true;
app.DebugPrintf("Attempted to mount DLC data for LGO %d\n", mountIndex);
}
}
else
{
setLoadedData();
app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ReloadTexturePack);
}
}
int LevelGenerationOptions::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask)
{
LevelGenerationOptions *lgo = (LevelGenerationOptions *)pParam;
lgo->m_bLoadingData = false;
if(dwErr!=ERROR_SUCCESS)
{
// corrupt DLC
app.DebugPrintf("Failed to mount LGO DLC for pad %d: %d\n",iPad,dwErr);
}
else
{
app.DebugPrintf("Mounted DLC for LGO, attempting to load data\n");
DWORD dwFilesProcessed = 0;
int gameRulesCount = lgo->m_parentDLCPack->getDLCItemsCount(DLCManager::e_DLCType_GameRulesHeader);
for(int i = 0; i < gameRulesCount; ++i)
{
DLCGameRulesHeader *dlcFile = (DLCGameRulesHeader *) lgo->m_parentDLCPack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
if (!dlcFile->getGrfPath().empty())
{
File grf( app.getFilePath(lgo->m_parentDLCPack->GetPackID(), dlcFile->getGrfPath(),true, L"WPACK:" ) );
if (grf.exists())
{
#ifdef _UNICODE
wstring path = grf.getPath();
const WCHAR *pchFilename=path.c_str();
HANDLE fileHandle = CreateFile(
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
NULL, // Unused
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
);
#else
const char *pchFilename=wstringtofilename(grf.getPath());
HANDLE fileHandle = CreateFile(
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
NULL, // Unused
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
);
#endif
if( fileHandle != INVALID_HANDLE_VALUE )
{
DWORD dwFileSize = grf.length();
DWORD bytesRead;
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
if(bSuccess==FALSE)
{
app.FatalLoadError();
}
CloseHandle(fileHandle);
// 4J-PB - is it possible that we can get here after a read fail and it's not an error?
dlcFile->setGrfData(pbData, dwFileSize, lgo->m_stringTable);
delete [] pbData;
app.m_gameRules.setLevelGenerationOptions( dlcFile->lgo );
}
}
}
}
if(lgo->requiresBaseSave() && !lgo->getBaseSavePath().empty() )
{
File save(app.getFilePath(lgo->m_parentDLCPack->GetPackID(), lgo->getBaseSavePath(),true, L"WPACK:" ));
if (save.exists())
{
#ifdef _UNICODE
wstring path = save.getPath();
const WCHAR *pchFilename=path.c_str();
HANDLE fileHandle = CreateFile(
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
NULL, // Unused
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
);
#else
const char *pchFilename=wstringtofilename(save.getPath());
HANDLE fileHandle = CreateFile(
pchFilename, // file name
GENERIC_READ, // access mode
0, // share mode // TODO 4J Stu - Will we need to share file? Probably not but...
NULL, // Unused
OPEN_EXISTING , // how to create // TODO 4J Stu - Assuming that the file already exists if we are opening to read from it
FILE_FLAG_SEQUENTIAL_SCAN, // file attributes
NULL // Unsupported
);
#endif
if( fileHandle != INVALID_HANDLE_VALUE )
{
DWORD bytesRead,dwFileSize = GetFileSize(fileHandle,NULL);
PBYTE pbData = (PBYTE) new BYTE[dwFileSize];
BOOL bSuccess = ReadFile(fileHandle,pbData,dwFileSize,&bytesRead,NULL);
if(bSuccess==FALSE)
{
app.FatalLoadError();
}
CloseHandle(fileHandle);
// 4J-PB - is it possible that we can get here after a read fail and it's not an error?
lgo->setBaseSaveData(pbData, dwFileSize);
}
}
}
#ifdef _DURANGO
DWORD result = StorageManager.UnmountInstalledDLC(L"WPACK");
#else
DWORD result = StorageManager.UnmountInstalledDLC("WPACK");
#endif
}
lgo->setLoadedData();
return 0;
}
void LevelGenerationOptions::reset_start()
{
for ( AUTO_VAR( it, m_schematicRules.begin());
it != m_schematicRules.end();
it++ )
it != m_schematicRules.end();
it++ )
{
(*it)->reset();
}
@@ -478,9 +649,38 @@ bool LevelGenerationOptions::isFromDLC() { return getSrc() == eSrc_fromDLC; }
bool LevelGenerationOptions::requiresTexturePack() { return info()->requiresTexturePack(); }
UINT LevelGenerationOptions::getRequiredTexturePackId() { return info()->getRequiredTexturePackId(); }
wstring LevelGenerationOptions::getDefaultSaveName() { return info()->getDefaultSaveName(); }
LPCWSTR LevelGenerationOptions::getWorldName() { return info()->getWorldName(); }
LPCWSTR LevelGenerationOptions::getDisplayName() { return info()->getDisplayName(); }
wstring LevelGenerationOptions::getDefaultSaveName()
{
switch (getSrc())
{
case eSrc_fromSave: return getString( info()->getDefaultSaveName() );
case eSrc_fromDLC: return getString( info()->getDefaultSaveName() );
case eSrc_tutorial: return app.GetString(IDS_TUTORIALSAVENAME);
}
return L"";
}
LPCWSTR LevelGenerationOptions::getWorldName()
{
switch (getSrc())
{
case eSrc_fromSave: return getString( info()->getWorldName() );
case eSrc_fromDLC: return getString( info()->getWorldName() );
case eSrc_tutorial: return app.GetString(IDS_PLAY_TUTORIAL);
}
return L"";
}
LPCWSTR LevelGenerationOptions::getDisplayName()
{
switch (getSrc())
{
case eSrc_fromSave: return getString( info()->getDisplayName() );
case eSrc_fromDLC: return getString( info()->getDisplayName() );
case eSrc_tutorial: return L"";
}
return L"";
}
wstring LevelGenerationOptions::getGrfPath() { return info()->getGrfPath(); }
bool LevelGenerationOptions::requiresBaseSave() { return info()->requiresBaseSave(); }
wstring LevelGenerationOptions::getBaseSavePath() { return info()->getBaseSavePath(); }
@@ -506,6 +706,7 @@ bool LevelGenerationOptions::hasLoadedData() { return m_hasLoadedData; }
void LevelGenerationOptions::setLoadedData() { m_hasLoadedData = true; }
__int64 LevelGenerationOptions::getLevelSeed() { return m_seed; }
int LevelGenerationOptions::getLevelHasBeenInCreative() { return m_bHasBeenInCreative; }
Pos *LevelGenerationOptions::getSpawnPos() { return m_spawnPos; }
bool LevelGenerationOptions::getuseFlatWorld() { return m_useFlatWorld; }

View File

@@ -149,6 +149,7 @@ private:
__int64 m_seed;
bool m_useFlatWorld;
Pos *m_spawnPos;
int m_bHasBeenInCreative;
vector<ApplySchematicRuleDefinition *> m_schematicRules;
vector<ConsoleGenerateStructure *> m_structureRules;
bool m_bHaveMinY;
@@ -162,8 +163,11 @@ private:
StringTable *m_stringTable;
DLCPack *m_parentDLCPack;
bool m_bLoadingData;
public:
LevelGenerationOptions();
LevelGenerationOptions(DLCPack *parentPack = NULL);
~LevelGenerationOptions();
virtual ConsoleGameRules::EGameRuleType getActionType();
@@ -174,6 +178,7 @@ public:
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
__int64 getLevelSeed();
int getLevelHasBeenInCreative();
Pos *getSpawnPos();
bool getuseFlatWorld();
@@ -197,12 +202,15 @@ public:
LevelRuleset *getRequiredGameRules();
void getBiomeOverride(int biomeId, BYTE &tile, BYTE &topTile);
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature);
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation = NULL);
void loadStringTable(StringTable *table);
LPCWSTR getString(const wstring &key);
unordered_map<wstring, ConsoleSchematicFile *> *getUnfinishedSchematicFiles();
void loadBaseSaveData();
static int packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask);
// 4J-JEV:
// ApplySchematicRules contain limited state

View File

@@ -6,12 +6,13 @@ StartFeature::StartFeature()
{
m_chunkX = 0;
m_chunkZ = 0;
m_orientation = 0;
m_feature = StructureFeature::eFeature_Temples;
}
void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs)
{
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
GameRuleDefinition::writeAttributes(dos, numAttrs + 4);
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_chunkX);
dos->writeUTF(_toString(m_chunkX));
@@ -19,6 +20,8 @@ void StartFeature::writeAttributes(DataOutputStream *dos, UINT numAttrs)
dos->writeUTF(_toString(m_chunkZ));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_feature);
dos->writeUTF(_toString((int)m_feature));
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
dos->writeUTF(_toString(m_orientation));
}
void StartFeature::addAttribute(const wstring &attributeName, const wstring &attributeValue)
@@ -35,6 +38,12 @@ void StartFeature::addAttribute(const wstring &attributeName, const wstring &att
m_chunkZ = value;
app.DebugPrintf("StartFeature: Adding parameter chunkZ=%d\n",m_chunkZ);
}
else if(attributeName.compare(L"orientation") == 0)
{
int value = _fromString<int>(attributeValue);
m_orientation = value;
app.DebugPrintf("StartFeature: Adding parameter orientation=%d\n",m_orientation);
}
else if(attributeName.compare(L"feature") == 0)
{
int value = _fromString<int>(attributeValue);
@@ -47,7 +56,8 @@ void StartFeature::addAttribute(const wstring &attributeName, const wstring &att
}
}
bool StartFeature::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature)
bool StartFeature::isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation)
{
if(orientation != NULL) *orientation = m_orientation;
return chunkX == m_chunkX && chunkZ == m_chunkZ && feature == m_feature;
}

View File

@@ -7,7 +7,7 @@ using namespace std;
class StartFeature : public GameRuleDefinition
{
private:
int m_chunkX, m_chunkZ;
int m_chunkX, m_chunkZ, m_orientation;
StructureFeature::EFeatureTypes m_feature;
public:
@@ -18,5 +18,5 @@ public:
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature);
bool isFeatureChunk(int chunkX, int chunkZ, StructureFeature::EFeatureTypes feature, int *orientation);
};

View File

@@ -74,16 +74,16 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
{
// Remove the current tile entity
level->removeTileEntity( worldX, worldY, worldZ );
level->setTile( worldX, worldY, worldZ, 0 );
level->setTileAndData( worldX, worldY, worldZ, 0, 0, Tile::UPDATE_ALL );
}
level->setTile( worldX, worldY, worldZ, m_tile );
level->setTileAndData( worldX, worldY, worldZ, m_tile, 0, Tile::UPDATE_ALL );
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 )
{
level->setData( worldX, worldY, worldZ, m_data);
level->setData( worldX, worldY, worldZ, m_data, Tile::UPDATE_CLIENTS);
// Add items
int slotId = 0;
for(AUTO_VAR(it, m_items.begin()); it != m_items.end() && (slotId < container->getContainerSize()); ++it, ++slotId )

View File

@@ -50,10 +50,10 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
{
// Remove the current tile entity
level->removeTileEntity( worldX, worldY, worldZ );
level->setTile( worldX, worldY, worldZ, 0 );
level->setTileAndData( worldX, worldY, worldZ, 0, 0, Tile::UPDATE_ALL );
}
level->setTile( worldX, worldY, worldZ, m_tile );
level->setTileAndData( worldX, worldY, worldZ, m_tile, 0, Tile::UPDATE_ALL );
shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>(level->getTileEntity( worldX, worldY, worldZ ));
#ifndef _CONTENT_PACKAGE

View File

@@ -0,0 +1,88 @@
#include "stdafx.h"
#include "LeaderboardInterface.h"
LeaderboardInterface::LeaderboardInterface(LeaderboardManager *man)
{
m_manager = man;
m_pending = false;
m_filter = (LeaderboardManager::EFilterMode) -1;
m_callback = NULL;
m_difficulty = 0;
m_type = LeaderboardManager::eStatsType_UNDEFINED;
m_startIndex = 0;
m_readCount = 0;
m_manager->OpenSession();
}
LeaderboardInterface::~LeaderboardInterface()
{
m_manager->CancelOperation();
m_manager->CloseSession();
}
void LeaderboardInterface::ReadStats_Friends(LeaderboardReadListener *callback, int difficulty, LeaderboardManager::EStatsType type, PlayerUID myUID, unsigned int startIndex, unsigned int readCount)
{
m_filter = LeaderboardManager::eFM_Friends;
m_pending = true;
m_callback = callback;
m_difficulty = difficulty;
m_type = type;
m_myUID = myUID;
m_startIndex = startIndex;
m_readCount = readCount;
tick();
}
void LeaderboardInterface::ReadStats_MyScore(LeaderboardReadListener *callback, int difficulty, LeaderboardManager::EStatsType type, PlayerUID myUID, unsigned int readCount)
{
m_filter = LeaderboardManager::eFM_MyScore;
m_pending = true;
m_callback = callback;
m_difficulty = difficulty;
m_type = type;
m_myUID = myUID;
m_readCount = readCount;
tick();
}
void LeaderboardInterface::ReadStats_TopRank(LeaderboardReadListener *callback, int difficulty, LeaderboardManager::EStatsType type, unsigned int startIndex, unsigned int readCount)
{
m_filter = LeaderboardManager::eFM_TopRank;
m_pending = true;
m_callback = callback;
m_difficulty = difficulty;
m_type = type;
m_startIndex = startIndex;
m_readCount = readCount;
tick();
}
void LeaderboardInterface::CancelOperation()
{
m_manager->CancelOperation();
m_pending = false;
}
void LeaderboardInterface::tick()
{
if (m_pending) m_pending = !callManager();
}
bool LeaderboardInterface::callManager()
{
switch (m_filter)
{
case LeaderboardManager::eFM_Friends: return m_manager->ReadStats_Friends(m_callback, m_difficulty, m_type, m_myUID, m_startIndex, m_readCount);
case LeaderboardManager::eFM_MyScore: return m_manager->ReadStats_MyScore(m_callback, m_difficulty, m_type, m_myUID, m_readCount);
case LeaderboardManager::eFM_TopRank: return m_manager->ReadStats_TopRank(m_callback, m_difficulty, m_type, m_startIndex, m_readCount);
default: assert(false); return true;
}
}

View File

@@ -0,0 +1,35 @@
#pragma once
#include "LeaderboardManager.h"
// 4J-JEV: Simple interface for handling ReadStat failures.
class LeaderboardInterface
{
private:
LeaderboardManager *m_manager;
bool m_pending;
// Arguments.
LeaderboardManager::EFilterMode m_filter;
LeaderboardReadListener *m_callback;
int m_difficulty;
LeaderboardManager::EStatsType m_type;
PlayerUID m_myUID;
unsigned int m_startIndex;
unsigned int m_readCount;
public:
LeaderboardInterface(LeaderboardManager *man);
~LeaderboardInterface();
void ReadStats_Friends(LeaderboardReadListener *callback, int difficulty, LeaderboardManager::EStatsType type, PlayerUID myUID, unsigned int startIndex, unsigned int readCount);
void ReadStats_MyScore(LeaderboardReadListener *callback, int difficulty, LeaderboardManager::EStatsType type, PlayerUID myUID, unsigned int readCount);
void ReadStats_TopRank(LeaderboardReadListener *callback, int difficulty, LeaderboardManager::EStatsType type, unsigned int startIndex, unsigned int readCount);
void CancelOperation();
void tick();
private:
bool callManager();
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,133 @@
#pragma once
#include "Common\Leaderboards\LeaderboardManager.h"
#ifdef __PS3__
typedef CellRtcTick SonyRtcTick;
#else
typedef SceRtcTick SonyRtcTick;
#endif
class SonyLeaderboardManager : public LeaderboardManager
{
protected:
enum EStatsState
{
eStatsState_Idle,
eStatsState_Getting,
eStatsState_Failed,
eStatsState_Ready,
eStatsState_Canceled,
eStatsState_Max
};
public:
SonyLeaderboardManager();
virtual ~SonyLeaderboardManager();
protected:
unsigned short m_openSessions;
C4JThread *m_threadScoreboard;
bool m_running;
int m_titleContext;
int32_t m_requestId;
//SceNpId m_myNpId;
static int scoreboardThreadEntry(LPVOID lpParam);
void scoreboardThreadInternal();
virtual bool getScoreByIds();
virtual bool getScoreByRange();
virtual bool setScore();
queue<RegisterScore> m_views;
CRITICAL_SECTION m_csViewsLock;
EStatsState m_eStatsState; //State of the stats read
// EFilterMode m_eFilterMode;
ReadScore *m_scores;
unsigned int m_maxRank;
//SceNpScoreRankData *m_stats;
public:
virtual void Tick();
//Open a session
virtual bool OpenSession();
//Close a session
virtual void CloseSession();
//Delete a session
virtual void DeleteSession();
//Write the given stats
//This is called synchronously and will not free any memory allocated for views when it is done
virtual bool WriteStats(unsigned int viewCount, ViewIn views);
virtual bool ReadStats_Friends(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int startIndex, unsigned int readCount);
virtual bool ReadStats_MyScore(LeaderboardReadListener *callback, int difficulty, EStatsType type, PlayerUID myUID, unsigned int readCount);
virtual bool ReadStats_TopRank(LeaderboardReadListener *callback, int difficulty, EStatsType type, unsigned int startIndex, unsigned int readCount);
//Perform a flush of the stats
virtual void FlushStats();
//Cancel the current operation
virtual void CancelOperation();
//Is the leaderboard manager idle.
virtual bool isIdle();
protected:
int getBoardId(int difficulty, EStatsType);
SceNpScorePlayerRankData *addPadding(unsigned int num, SceNpScoreRankData *rankData);
void convertToOutput(unsigned int &num, ReadScore *out, SceNpScorePlayerRankData *rankData, SceNpScoreComment *comm);
void toBinary(void *out, SceNpScoreComment *in);
void fromBinary(SceNpScoreComment **out, void *in);
void toBase32(SceNpScoreComment *out, void *in);
void fromBase32(void *out, SceNpScoreComment *in);
void toSymbols(char *);
void fromSymbols(char *);
bool test_string(string);
void initReadScoreStruct(ReadScore &out, SceNpScoreRankData &);
void fillReadScoreStruct(ReadScore &out, SceNpScoreComment &comment);
static bool SortByRank(const ReadScore &lhs, const ReadScore &rhs);
protected:
// 4J-JEV: Interface differences:
// Sce NP score library function redirects.
virtual HRESULT initialiseScoreUtility() { return ERROR_SUCCESS; }
virtual bool scoreUtilityAlreadyInitialised(HRESULT hr) { return false; }
virtual HRESULT createTitleContext(const SceNpId &npId) = 0;
virtual HRESULT destroyTitleContext(int titleContext) = 0;
virtual HRESULT createTransactionContext(int titleContext) = 0;
virtual HRESULT abortTransactionContext(int transactionContext) = 0;
virtual HRESULT destroyTransactionContext(int transactionContext) = 0;
virtual HRESULT fillByIdsQuery(const SceNpId &myNpId, SceNpId* &npIds, uint32_t &len);
#if (defined __ORBIS__) || (defined __PSVITA__)
virtual HRESULT getFriendsList(sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> &friendsList) = 0;
#endif
virtual char * getComment(SceNpScoreComment *comment) = 0;
};

View File

@@ -0,0 +1,131 @@
/*
base64.cpp and base64.h
Copyright (C) 2004-2008 Ren<65> Nyffenegger
This source code is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this source code must not be misrepresented; you must not
claim that you wrote the original source code. If you use this source code
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original source code.
3. This notice may not be removed or altered from any source distribution.
Ren<65> Nyffenegger rene.nyffenegger@adp-gmbh.ch
*/
#include "stdafx.h"
#include "base64.h"
#include <iostream>
static const std::string base64_chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
static inline bool is_base64(unsigned char c) {
return (isalnum(c) || (c == '+') || (c == '/'));
}
// 4J ADDED,
std::string base64_encode(std::string str)
{
return base64_encode( reinterpret_cast<const unsigned char*>(str.c_str()), str.length() );
}
std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) {
std::string ret;
int i = 0;
int j = 0;
unsigned char char_array_3[3];
unsigned char char_array_4[4];
while (in_len--) {
char_array_3[i++] = *(bytes_to_encode++);
if (i == 3) {
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
char_array_4[3] = char_array_3[2] & 0x3f;
for(int ii = 0; (ii <4) ; ii++)
ret += base64_chars[char_array_4[ii]];
i = 0;
}
}
if (i)
{
for(j = i; j < 3; j++)
char_array_3[j] = '\0';
char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
char_array_4[3] = char_array_3[2] & 0x3f;
for (j = 0; (j < i + 1); j++)
ret += base64_chars[char_array_4[j]];
while((i++ < 3))
ret += '=';
}
return ret;
}
std::string base64_decode(std::string const& encoded_string) {
int in_len = encoded_string.size();
int i = 0;
int j = 0;
int in_ = 0;
unsigned char char_array_4[4], char_array_3[3];
std::string ret;
while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
char_array_4[i++] = encoded_string[in_]; in_++;
if (i ==4) {
for (i = 0; i <4; i++)
char_array_4[i] = base64_chars.find(char_array_4[i]);
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
for (i = 0; (i < 3); i++)
ret += char_array_3[i];
i = 0;
}
}
if (i) {
for (j = i; j <4; j++)
char_array_4[j] = 0;
for (j = 0; j <4; j++)
char_array_4[j] = base64_chars.find(char_array_4[j]);
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
}
return ret;
}

View File

@@ -0,0 +1,7 @@
#pragma once
#include <string>
std::string base64_encode(std::string str);
std::string base64_encode(unsigned char const* , unsigned int len);
std::string base64_decode(std::string const& s);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

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