mirror of
https://github.com/LCEMP/LCEMP.git
synced 2026-06-28 10:27:03 +00:00
Initial commit - LCEMP source code (assets excluded)
This commit is contained in:
commit
21a5a4aef0
179
.gitignore
vendored
Normal file
179
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
# ===========================================
|
||||
# Build outputs
|
||||
# ===========================================
|
||||
x64/
|
||||
Minecraft.Client/x64/
|
||||
Minecraft.World/x64_Debug/
|
||||
Minecraft.World/x64_Release/
|
||||
ipch/
|
||||
|
||||
# ===========================================
|
||||
# Visual Studio files
|
||||
# ===========================================
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.suo
|
||||
*.user
|
||||
*.vspscc
|
||||
*.pdb
|
||||
*.obj
|
||||
*.pch
|
||||
*.lib
|
||||
*.exe
|
||||
*.dll
|
||||
*.tlog
|
||||
*.lastbuildstate
|
||||
*.log
|
||||
*.idb
|
||||
*.ilk
|
||||
*.exp
|
||||
|
||||
# ===========================================
|
||||
# Archives & packaged binaries
|
||||
# ===========================================
|
||||
*.zip
|
||||
|
||||
# ===========================================
|
||||
# Copyrighted game assets (Mojang/Microsoft)
|
||||
# Users must supply these from a legal copy.
|
||||
# ===========================================
|
||||
|
||||
# Music (Binka audio - all platforms)
|
||||
Minecraft.Client/music/
|
||||
*.binka
|
||||
|
||||
# Common Media - UI (SWF), Graphics (PNG), Sound (WAV), Fonts
|
||||
Minecraft.Client/Common/Media/
|
||||
# Game resource textures, art, audio, etc.
|
||||
Minecraft.Client/Common/res/
|
||||
Minecraft.Client/Common/DummyTexturePack/
|
||||
|
||||
# Platform-specific media directories
|
||||
Minecraft.Client/DurangoMedia/
|
||||
Minecraft.Client/OrbisMedia/
|
||||
Minecraft.Client/PS3Media/
|
||||
Minecraft.Client/PSVitaMedia/
|
||||
Minecraft.Client/Windows64Media/
|
||||
|
||||
# Console package / system data
|
||||
Minecraft.Client/PS3_GAME/
|
||||
Minecraft.Client/PS4_GAME/
|
||||
Minecraft.Client/sce_sys/
|
||||
Minecraft.Client/TROPDIR/
|
||||
|
||||
# Save data directories
|
||||
Minecraft.Client/Windows64/GameHDD/
|
||||
|
||||
# Thumbnail / test images
|
||||
*.png
|
||||
# But allow source code PNG references to be noted
|
||||
!Minecraft.Client/Common/Media/Graphics/.gitkeep
|
||||
|
||||
# SWF UI files (Flash-based UI assets)
|
||||
*.swf
|
||||
|
||||
# Arc archives (packed texture/media bundles)
|
||||
*.arc
|
||||
|
||||
# Miles Sound System redistributables
|
||||
Minecraft.Client/redist64/
|
||||
*.asi
|
||||
*.flt
|
||||
|
||||
# ===========================================
|
||||
# Third-party / proprietary middleware
|
||||
# ===========================================
|
||||
|
||||
# 4J Studios proprietary libraries
|
||||
**/4JLibs/
|
||||
|
||||
# Miles Sound System (RAD Game Tools)
|
||||
**/Miles/
|
||||
|
||||
# Iggy / Scaleform UI middleware (RAD Game Tools)
|
||||
**/Iggy/
|
||||
|
||||
# Sentient middleware
|
||||
**/Sentient/
|
||||
|
||||
# ===========================================
|
||||
# Console-specific SDK / platform files
|
||||
# ===========================================
|
||||
|
||||
# Xbox SPU tasks
|
||||
**/SPU_Tasks/
|
||||
|
||||
# PS3 Edge libraries
|
||||
Minecraft.Client/PS3/Edge/
|
||||
Minecraft.Client/PS3/DATA/
|
||||
Minecraft.Client/PS3/Media/
|
||||
Minecraft.Client/PS3/Passphrase/
|
||||
|
||||
# Durango (Xbox One) extras
|
||||
Minecraft.Client/Durango/DLCImages/
|
||||
Minecraft.Client/Durango/Layout/
|
||||
Minecraft.Client/Durango/Sound/
|
||||
Minecraft.Client/Durango/CU/
|
||||
|
||||
# Orbis (PS4) extras
|
||||
Minecraft.Client/Orbis/DLCImages/
|
||||
Minecraft.Client/Orbis/GameConfig/
|
||||
|
||||
# PSVita extras
|
||||
Minecraft.Client/PSVita/app/
|
||||
Minecraft.Client/PSVita/Builds/
|
||||
|
||||
# Xbox (360) extras
|
||||
Minecraft.Client/Xbox/Audio/
|
||||
Minecraft.Client/Xbox/Font/
|
||||
Minecraft.Client/Xbox/kinect/
|
||||
Minecraft.Client/Xbox/loc/
|
||||
Minecraft.Client/Xbox/ContentPackageBuild/
|
||||
Minecraft.Client/Xbox/ReleaseBuild/
|
||||
Minecraft.Client/Xbox/SubmissionBuild/
|
||||
Minecraft.Client/Xbox/TMSFiles/
|
||||
Minecraft.Client/Xbox/Cheats/
|
||||
Minecraft.Client/Xbox/Docs/
|
||||
Minecraft.Client/Xbox/Title Update/
|
||||
|
||||
# ===========================================
|
||||
# Platform DLC content directories
|
||||
# ===========================================
|
||||
**/DLC/
|
||||
|
||||
# ===========================================
|
||||
# Misc binary/compiled assets
|
||||
# ===========================================
|
||||
*.msscmp
|
||||
*.cd
|
||||
*.xap
|
||||
*.bin
|
||||
*.sfo
|
||||
*.at9
|
||||
*.sig
|
||||
*.dat
|
||||
*.ico
|
||||
*.rc
|
||||
*.jpg
|
||||
*.docx
|
||||
*.xlsx
|
||||
*.rtf
|
||||
*.spa
|
||||
*.winmd
|
||||
*.alignmentchunk
|
||||
*.trp
|
||||
*.gameconfig
|
||||
|
||||
# ===========================================
|
||||
# Third-party libraries (boost, DirectX, etc.)
|
||||
# ===========================================
|
||||
Minecraft.Client/PS3/PS3Extras/boost_*/
|
||||
Minecraft.Client/PS3/PS3Extras/DirectX/
|
||||
Minecraft.Client/PS3/PS3Extras/HeapInspector/
|
||||
|
||||
# Static libraries and compiled packages
|
||||
*.a
|
||||
*.cmp
|
||||
|
||||
# Sony remote storage libs
|
||||
Minecraft.Client/Common/Network/Sony/
|
||||
235
Minecraft.Client/AbstractContainerScreen.cpp
Normal file
235
Minecraft.Client/AbstractContainerScreen.cpp
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
#include "stdafx.h"
|
||||
#include "AbstractContainerScreen.h"
|
||||
#include "ItemRenderer.h"
|
||||
#include "MultiplayerLocalPlayer.h"
|
||||
#include "Lighting.h"
|
||||
#include "GameMode.h"
|
||||
#include "KeyMapping.h"
|
||||
#include "Options.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||
#include "..\Minecraft.World\net.minecraft.locale.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.item.h"
|
||||
|
||||
ItemRenderer *AbstractContainerScreen::itemRenderer = new ItemRenderer();
|
||||
|
||||
AbstractContainerScreen::AbstractContainerScreen(AbstractContainerMenu *menu)
|
||||
{
|
||||
// 4J - added initialisers
|
||||
imageWidth = 176;
|
||||
imageHeight = 166;
|
||||
|
||||
this->menu = menu;
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::init()
|
||||
{
|
||||
Screen::init();
|
||||
minecraft->player->containerMenu = menu;
|
||||
// leftPos = (width - imageWidth) / 2;
|
||||
// topPos = (height - imageHeight) / 2;
|
||||
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::render(int xm, int ym, float a)
|
||||
{
|
||||
// 4J Stu - Not used
|
||||
#if 0
|
||||
renderBackground();
|
||||
int xo = (width - imageWidth) / 2;
|
||||
int yo = (height - imageHeight) / 2;
|
||||
|
||||
renderBg(a);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(120, 1, 0, 0);
|
||||
Lighting::turnOn();
|
||||
glPopMatrix();
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef((float)xo, (float)yo, 0);
|
||||
|
||||
glColor4f(1, 1, 1, 1);
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
|
||||
Slot *hoveredSlot = NULL;
|
||||
|
||||
AUTO_VAR(itEnd, menu->slots->end());
|
||||
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
|
||||
{
|
||||
Slot *slot = *it; //menu->slots->at(i);
|
||||
|
||||
renderSlot(slot);
|
||||
|
||||
if (isHovering(slot, xm, ym))
|
||||
{
|
||||
hoveredSlot = slot;
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
int x = slot->x;
|
||||
int y = slot->y;
|
||||
fillGradient(x, y, x + 16, y + 16, 0x80ffffff, 0x80ffffff);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr<Inventory> inventory = minecraft->player->inventory;
|
||||
if (inventory->getCarried() != NULL)
|
||||
{
|
||||
glTranslatef(0, 0, 32);
|
||||
// Slot old = carriedSlot;
|
||||
// carriedSlot = null;
|
||||
itemRenderer->renderGuiItem(font, minecraft->textures, inventory->getCarried(), xm - xo - 8, ym - yo - 8);
|
||||
itemRenderer->renderGuiItemDecorations(font, minecraft->textures, inventory->getCarried(), xm - xo - 8, ym - yo - 8);
|
||||
// carriedSlot = old;
|
||||
}
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
Lighting::turnOff();
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
renderLabels();
|
||||
|
||||
if (inventory->getCarried() == NULL && hoveredSlot != NULL && hoveredSlot->hasItem())
|
||||
{
|
||||
|
||||
wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
|
||||
|
||||
if (elementName.length() > 0)
|
||||
{
|
||||
int x = xm - xo + 12;
|
||||
int y = ym - yo - 12;
|
||||
int width = font->width(elementName);
|
||||
fillGradient(x - 3, y - 3, x + width + 3, y + 8 + 3, 0xc0000000, 0xc0000000);
|
||||
|
||||
font->drawShadow(elementName, x, y, 0xffffffff);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
Screen::render(xm, ym, a);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::renderLabels()
|
||||
{
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::renderSlot(Slot *slot)
|
||||
{
|
||||
// 4J Unused
|
||||
#if 0
|
||||
int x = slot->x;
|
||||
int y = slot->y;
|
||||
shared_ptr<ItemInstance> item = slot->getItem();
|
||||
|
||||
if (item == NULL)
|
||||
{
|
||||
int icon = slot->getNoItemIcon();
|
||||
if (icon >= 0)
|
||||
{
|
||||
glDisable(GL_LIGHTING);
|
||||
minecraft->textures->bind(minecraft->textures->loadTexture(TN_GUI_ITEMS));//L"/gui/items.png"));
|
||||
blit(x, y, icon % 16 * 16, icon / 16 * 16, 16, 16);
|
||||
glEnable(GL_LIGHTING);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
itemRenderer->renderGuiItem(font, minecraft->textures, item, x, y);
|
||||
itemRenderer->renderGuiItemDecorations(font, minecraft->textures, item, x, y);
|
||||
#endif
|
||||
}
|
||||
|
||||
Slot *AbstractContainerScreen::findSlot(int x, int y)
|
||||
{
|
||||
AUTO_VAR(itEnd, menu->slots->end());
|
||||
for (AUTO_VAR(it, menu->slots->begin()); it != itEnd; it++)
|
||||
{
|
||||
Slot *slot = *it; //menu->slots->at(i);
|
||||
if (isHovering(slot, x, y)) return slot;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool AbstractContainerScreen::isHovering(Slot *slot, int xm, int ym)
|
||||
{
|
||||
int xo = (width - imageWidth) / 2;
|
||||
int yo = (height - imageHeight) / 2;
|
||||
xm -= xo;
|
||||
ym -= yo;
|
||||
|
||||
return xm >= slot->x - 1 && xm < slot->x + 16 + 1 && ym >= slot->y - 1 && ym < slot->y + 16 + 1;
|
||||
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::mouseClicked(int x, int y, int buttonNum)
|
||||
{
|
||||
Screen::mouseClicked(x, y, buttonNum);
|
||||
if (buttonNum == 0 || buttonNum == 1)
|
||||
{
|
||||
Slot *slot = findSlot(x, y);
|
||||
|
||||
int xo = (width - imageWidth) / 2;
|
||||
int yo = (height - imageHeight) / 2;
|
||||
bool clickedOutside = (x < xo || y < yo || x >= xo + imageWidth || y >= yo + imageHeight);
|
||||
|
||||
int slotId = -1;
|
||||
if (slot != NULL) slotId = slot->index;
|
||||
|
||||
if (clickedOutside)
|
||||
{
|
||||
slotId = AbstractContainerMenu::CLICKED_OUTSIDE;
|
||||
}
|
||||
|
||||
if (slotId != -1)
|
||||
{
|
||||
bool quickKey = slotId != AbstractContainerMenu::CLICKED_OUTSIDE && (Keyboard::isKeyDown(Keyboard::KEY_LSHIFT) || Keyboard::isKeyDown(Keyboard::KEY_RSHIFT));
|
||||
minecraft->gameMode->handleInventoryMouseClick(menu->containerId, slotId, buttonNum, quickKey, minecraft->player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::mouseReleased(int x, int y, int buttonNum)
|
||||
{
|
||||
if (buttonNum == 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::keyPressed(wchar_t eventCharacter, int eventKey)
|
||||
{
|
||||
if (eventKey == Keyboard::KEY_ESCAPE || eventKey == minecraft->options->keyBuild->key)
|
||||
{
|
||||
minecraft->player->closeContainer();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::removed()
|
||||
{
|
||||
if (minecraft->player == NULL) return;
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::slotsChanged(shared_ptr<Container> container)
|
||||
{
|
||||
}
|
||||
|
||||
bool AbstractContainerScreen::isPauseScreen()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void AbstractContainerScreen::tick()
|
||||
{
|
||||
Screen::tick();
|
||||
if (!minecraft->player->isAlive() || minecraft->player->removed) minecraft->player->closeContainer();
|
||||
|
||||
}
|
||||
38
Minecraft.Client/AbstractContainerScreen.h
Normal file
38
Minecraft.Client/AbstractContainerScreen.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
#include "Screen.h"
|
||||
class ItemRenderer;
|
||||
class AbstractContainerMenu;
|
||||
class Slot;
|
||||
class Container;
|
||||
|
||||
class AbstractContainerScreen : public Screen
|
||||
{
|
||||
private:
|
||||
static ItemRenderer *itemRenderer;
|
||||
protected:
|
||||
int imageWidth;
|
||||
int imageHeight;
|
||||
//int leftPos, topPos;
|
||||
public:
|
||||
AbstractContainerMenu *menu;
|
||||
|
||||
AbstractContainerScreen(AbstractContainerMenu *menu);
|
||||
virtual void init();
|
||||
virtual void render(int xm, int ym, float a);
|
||||
protected:
|
||||
virtual void renderLabels();
|
||||
virtual void renderBg(float a) = 0;
|
||||
private:
|
||||
virtual void renderSlot(Slot *slot);
|
||||
virtual Slot *findSlot(int x, int y);
|
||||
virtual bool isHovering(Slot *slot, int xm, int ym);
|
||||
protected:
|
||||
virtual void mouseClicked(int x, int y, int buttonNum);
|
||||
virtual void mouseReleased(int x, int y, int buttonNum);
|
||||
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
|
||||
public:
|
||||
virtual void removed();
|
||||
virtual void slotsChanged(shared_ptr<Container> container);
|
||||
virtual bool isPauseScreen();
|
||||
virtual void tick();
|
||||
};
|
||||
399
Minecraft.Client/AbstractTexturePack.cpp
Normal file
399
Minecraft.Client/AbstractTexturePack.cpp
Normal file
|
|
@ -0,0 +1,399 @@
|
|||
#include "stdafx.h"
|
||||
#include "Textures.h"
|
||||
#include "AbstractTexturePack.h"
|
||||
#include "..\Minecraft.World\InputOutputStream.h"
|
||||
#include "..\Minecraft.World\StringHelpers.h"
|
||||
|
||||
AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback) : id(id), name(name)
|
||||
{
|
||||
// 4J init
|
||||
textureId = -1;
|
||||
m_colourTable = NULL;
|
||||
|
||||
|
||||
this->file = file;
|
||||
this->fallback = fallback;
|
||||
|
||||
m_iconData = NULL;
|
||||
m_iconSize = 0;
|
||||
|
||||
m_comparisonData = NULL;
|
||||
m_comparisonSize = 0;
|
||||
|
||||
// 4J Stu - These calls need to be in the most derived version of the class
|
||||
//loadIcon();
|
||||
//loadDescription();
|
||||
}
|
||||
|
||||
wstring AbstractTexturePack::trim(wstring line)
|
||||
{
|
||||
if (!line.empty() && line.length() > 34)
|
||||
{
|
||||
line = line.substr(0, 34);
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadIcon()
|
||||
{
|
||||
#ifdef _XBOX
|
||||
// 4J Stu - Temporary only
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png");
|
||||
|
||||
UINT size = 0;
|
||||
HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_iconData, &size);
|
||||
m_iconSize = size;
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadComparison()
|
||||
{
|
||||
#ifdef _XBOX
|
||||
// 4J Stu - Temporary only
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DefaultPack_Comparison.png");
|
||||
|
||||
UINT size = 0;
|
||||
HRESULT hr = XuiResourceLoadAllNoLoc(szResourceLocator, &m_comparisonData, &size);
|
||||
m_comparisonSize = size;
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadDescription()
|
||||
{
|
||||
// 4J Unused currently
|
||||
#if 0
|
||||
InputStream *inputStream = NULL;
|
||||
BufferedReader *br = NULL;
|
||||
//try {
|
||||
inputStream = getResourceImplementation(L"/pack.txt");
|
||||
br = new BufferedReader(new InputStreamReader(inputStream));
|
||||
desc1 = trim(br->readLine());
|
||||
desc2 = trim(br->readLine());
|
||||
//} catch (IOException ignored) {
|
||||
//} finally {
|
||||
// TODO [EB]: use IOUtils.closeSilently()
|
||||
// try {
|
||||
if (br != NULL)
|
||||
{
|
||||
br->close();
|
||||
delete br;
|
||||
}
|
||||
if (inputStream != NULL)
|
||||
{
|
||||
inputStream->close();
|
||||
delete inputStream;
|
||||
}
|
||||
// } catch (IOException ignored) {
|
||||
// }
|
||||
//}
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadName()
|
||||
{
|
||||
}
|
||||
|
||||
InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFallback) //throws IOException
|
||||
{
|
||||
app.DebugPrintf("texture - %ls\n",name.c_str());
|
||||
InputStream *is = getResourceImplementation(name);
|
||||
if (is == NULL && fallback != NULL && allowFallback)
|
||||
{
|
||||
is = fallback->getResource(name, true);
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
// 4J Currently removed due to override in TexturePack class
|
||||
//InputStream *AbstractTexturePack::getResource(const wstring &name) //throws IOException
|
||||
//{
|
||||
// return getResource(name, true);
|
||||
//}
|
||||
|
||||
void AbstractTexturePack::unload(Textures *textures)
|
||||
{
|
||||
if (iconImage != NULL && textureId != -1)
|
||||
{
|
||||
textures->releaseTexture(textureId);
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractTexturePack::load(Textures *textures)
|
||||
{
|
||||
if (iconImage != NULL)
|
||||
{
|
||||
if (textureId == -1)
|
||||
{
|
||||
textureId = textures->getTexture(iconImage);
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, textureId);
|
||||
textures->clearLastBoundId();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 4J Stu - Don't do this
|
||||
//textures->bindTexture(L"/gui/unknown_pack.png");
|
||||
}
|
||||
}
|
||||
|
||||
bool AbstractTexturePack::hasFile(const wstring &name, bool allowFallback)
|
||||
{
|
||||
bool hasFile = this->hasFile(name);
|
||||
|
||||
return !hasFile && (allowFallback && fallback != NULL) ? fallback->hasFile(name, allowFallback) : hasFile;
|
||||
}
|
||||
|
||||
DWORD AbstractTexturePack::getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
wstring AbstractTexturePack::getName()
|
||||
{
|
||||
return texname;
|
||||
}
|
||||
|
||||
wstring AbstractTexturePack::getWorldName()
|
||||
{
|
||||
return m_wsWorldName;
|
||||
}
|
||||
|
||||
wstring AbstractTexturePack::getDesc1()
|
||||
{
|
||||
return desc1;
|
||||
}
|
||||
|
||||
wstring AbstractTexturePack::getDesc2()
|
||||
{
|
||||
return desc2;
|
||||
}
|
||||
|
||||
wstring AbstractTexturePack::getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback)
|
||||
{
|
||||
return getAnimationString(textureName, path);
|
||||
}
|
||||
|
||||
wstring AbstractTexturePack::getAnimationString(const wstring &textureName, const wstring &path)
|
||||
{
|
||||
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())
|
||||
{
|
||||
line = trimString(line);
|
||||
if (line.length() > 0)
|
||||
{
|
||||
result.append(L",");
|
||||
result.append(line);
|
||||
}
|
||||
line = br.readLine();
|
||||
}
|
||||
delete fileStream;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BufferedImage *AbstractTexturePack::getImageResource(const wstring& File, bool filenameHasExtension /*= false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/)
|
||||
{
|
||||
const char *pchTexture=wstringtofilename(File);
|
||||
app.DebugPrintf("AbstractTexturePack::getImageResource - %s, drive is %s\n",pchTexture, wstringtofilename(drive));
|
||||
|
||||
return new BufferedImage(TexturePack::getResource(L"/" + File),filenameHasExtension,bTitleUpdateTexture,drive);
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadDefaultUI()
|
||||
{
|
||||
#ifdef _XBOX
|
||||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
// Load new skin
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur");
|
||||
|
||||
XuiFreeVisuals(L"");
|
||||
app.LoadSkin(szResourceLocator,NULL);//L"TexturePack");
|
||||
//CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack");
|
||||
CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
|
||||
#else
|
||||
ui.ReloadSkin();
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadColourTable()
|
||||
{
|
||||
loadDefaultColourTable();
|
||||
loadDefaultHTMLColourTable();
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadDefaultColourTable()
|
||||
{
|
||||
// Load the file
|
||||
File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col"));
|
||||
|
||||
if(coloursFile.exists())
|
||||
{
|
||||
DWORD dwLength = coloursFile.length();
|
||||
byteArray data(dwLength);
|
||||
|
||||
FileInputStream fis(coloursFile);
|
||||
fis.read(data,0,dwLength);
|
||||
fis.close();
|
||||
if(m_colourTable != NULL) delete m_colourTable;
|
||||
m_colourTable = new ColourTable(data.data, dwLength);
|
||||
|
||||
delete [] data.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
app.DebugPrintf("Failed to load the default colours table\n");
|
||||
app.FatalLoadError();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractTexturePack::loadDefaultHTMLColourTable()
|
||||
{
|
||||
#ifdef _XBOX
|
||||
// load from the .xzp file
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
// Try and load the HTMLColours.col based off the common XML first, before the deprecated xuiscene_colourtable
|
||||
wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/HTMLColours.col");
|
||||
BYTE *data;
|
||||
UINT dataLength;
|
||||
if(XuiResourceLoadAll(szResourceLocator, &data, &dataLength) == S_OK)
|
||||
{
|
||||
m_colourTable->loadColoursFromData(data,dataLength);
|
||||
|
||||
XuiFree(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/");
|
||||
HXUIOBJ hScene;
|
||||
HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", NULL, &hScene);
|
||||
|
||||
if(HRESULT_SUCCEEDED(hr))
|
||||
{
|
||||
loadHTMLColourTableFromXuiScene(hScene);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if(app.hasArchiveFile(L"HTMLColours.col"))
|
||||
{
|
||||
byteArray textColours = app.getArchiveFile(L"HTMLColours.col");
|
||||
m_colourTable->loadColoursFromData(textColours.data,textColours.length);
|
||||
|
||||
delete [] textColours.data;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _XBOX
|
||||
void AbstractTexturePack::loadHTMLColourTableFromXuiScene(HXUIOBJ hObj)
|
||||
{
|
||||
HXUIOBJ child;
|
||||
HRESULT hr = XuiElementGetFirstChild(hObj, &child);
|
||||
|
||||
while(HRESULT_SUCCEEDED(hr) && child != NULL)
|
||||
{
|
||||
LPCWSTR childName;
|
||||
XuiElementGetId(child,&childName);
|
||||
m_colourTable->setColour(childName,XuiTextElementGetText(child));
|
||||
|
||||
//eMinecraftTextColours colourIndex = eTextColor_NONE;
|
||||
//for(int i = 0; i < (int)eTextColor_MAX; i++)
|
||||
//{
|
||||
// if(wcscmp(HTMLColourTableElements[i],childName)==0)
|
||||
// {
|
||||
// colourIndex = (eMinecraftTextColours)i;
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
|
||||
//LPCWSTR stringValue = XuiTextElementGetText(child);
|
||||
|
||||
//m_htmlColourTable[colourIndex] = XuiTextElementGetText(child);
|
||||
|
||||
hr = XuiElementGetNext(child, &child);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void AbstractTexturePack::loadUI()
|
||||
{
|
||||
loadColourTable();
|
||||
|
||||
#ifdef _XBOX
|
||||
CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbstractTexturePack::unloadUI()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
wstring AbstractTexturePack::getXuiRootPath()
|
||||
{
|
||||
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
|
||||
|
||||
// Load new skin
|
||||
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
|
||||
WCHAR szResourceLocator[ LOCATOR_SIZE ];
|
||||
|
||||
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/");
|
||||
return szResourceLocator;
|
||||
}
|
||||
|
||||
PBYTE AbstractTexturePack::getPackIcon(DWORD &dwImageBytes)
|
||||
{
|
||||
if(m_iconSize == 0 || m_iconData == NULL) loadIcon();
|
||||
dwImageBytes = m_iconSize;
|
||||
return m_iconData;
|
||||
}
|
||||
|
||||
PBYTE AbstractTexturePack::getPackComparison(DWORD &dwImageBytes)
|
||||
{
|
||||
if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison();
|
||||
|
||||
dwImageBytes = m_comparisonSize;
|
||||
return m_comparisonData;
|
||||
}
|
||||
|
||||
unsigned int AbstractTexturePack::getDLCParentPackId()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char AbstractTexturePack::getDLCSubPackId()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
93
Minecraft.Client/AbstractTexturePack.h
Normal file
93
Minecraft.Client/AbstractTexturePack.h
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
#include "TexturePack.h"
|
||||
|
||||
class BufferedImage;
|
||||
|
||||
class AbstractTexturePack : public TexturePack
|
||||
{
|
||||
private:
|
||||
const DWORD id;
|
||||
const wstring name;
|
||||
|
||||
protected:
|
||||
File *file;
|
||||
wstring texname;
|
||||
wstring m_wsWorldName;
|
||||
|
||||
wstring desc1;
|
||||
wstring desc2;
|
||||
|
||||
PBYTE m_iconData;
|
||||
DWORD m_iconSize;
|
||||
|
||||
PBYTE m_comparisonData;
|
||||
DWORD m_comparisonSize;
|
||||
|
||||
TexturePack *fallback;
|
||||
|
||||
ColourTable *m_colourTable;
|
||||
|
||||
protected:
|
||||
BufferedImage *iconImage;
|
||||
|
||||
private:
|
||||
int textureId;
|
||||
|
||||
protected:
|
||||
AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback);
|
||||
|
||||
private:
|
||||
static wstring trim(wstring line);
|
||||
|
||||
protected:
|
||||
virtual void loadIcon();
|
||||
virtual void loadComparison();
|
||||
virtual void loadDescription();
|
||||
virtual void loadName();
|
||||
|
||||
public:
|
||||
virtual InputStream *getResource(const wstring &name, bool allowFallback); //throws IOException
|
||||
// 4J Removed do to current override in TexturePack class
|
||||
//virtual InputStream *getResource(const wstring &name); //throws IOException
|
||||
virtual DLCPack * getDLCPack() =0;
|
||||
|
||||
|
||||
protected:
|
||||
virtual InputStream *getResourceImplementation(const wstring &name) = 0; // throws IOException;
|
||||
public:
|
||||
virtual void unload(Textures *textures);
|
||||
virtual void load(Textures *textures);
|
||||
virtual bool hasFile(const wstring &name, bool allowFallback);
|
||||
virtual bool hasFile(const wstring &name) = 0;
|
||||
virtual DWORD getId();
|
||||
virtual wstring getName();
|
||||
virtual wstring getDesc1();
|
||||
virtual wstring getDesc2();
|
||||
virtual wstring getWorldName();
|
||||
|
||||
virtual wstring getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback);
|
||||
|
||||
protected:
|
||||
virtual wstring getAnimationString(const wstring &textureName, const wstring &path);
|
||||
void loadDefaultUI();
|
||||
void loadDefaultColourTable();
|
||||
void loadDefaultHTMLColourTable();
|
||||
#ifdef _XBOX
|
||||
void loadHTMLColourTableFromXuiScene(HXUIOBJ hObj);
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L"");
|
||||
virtual void loadColourTable();
|
||||
virtual void loadUI();
|
||||
virtual void unloadUI();
|
||||
virtual wstring getXuiRootPath();
|
||||
virtual PBYTE getPackIcon(DWORD &dwImageBytes);
|
||||
virtual PBYTE getPackComparison(DWORD &dwImageBytes);
|
||||
virtual unsigned int getDLCParentPackId();
|
||||
virtual unsigned char getDLCSubPackId();
|
||||
virtual ColourTable *getColourTable() { return m_colourTable; }
|
||||
virtual ArchiveFile *getArchiveFile() { return NULL; }
|
||||
};
|
||||
151
Minecraft.Client/AchievementPopup.cpp
Normal file
151
Minecraft.Client/AchievementPopup.cpp
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
#include "stdafx.h"
|
||||
#include "AchievementPopup.h"
|
||||
#include "ItemRenderer.h"
|
||||
#include "Font.h"
|
||||
#include "Textures.h"
|
||||
#include "Lighting.h"
|
||||
#include "..\Minecraft.World\System.h"
|
||||
#include "..\Minecraft.World\net.minecraft.locale.h"
|
||||
#include "..\Minecraft.World\net.minecraft.stats.h"
|
||||
#include "..\Minecraft.World\SharedConstants.h"
|
||||
|
||||
AchievementPopup::AchievementPopup(Minecraft *mc)
|
||||
{
|
||||
// 4J - added initialisers
|
||||
width = 0;
|
||||
height = 0;
|
||||
ach = NULL;
|
||||
startTime = 0;
|
||||
isHelper = false;
|
||||
|
||||
this->mc = mc;
|
||||
ir = new ItemRenderer();
|
||||
}
|
||||
|
||||
void AchievementPopup::popup(Achievement *ach)
|
||||
{
|
||||
title = I18n::get(L"achievement.get");
|
||||
desc = ach->name;
|
||||
startTime = System::currentTimeMillis();
|
||||
this->ach = ach;
|
||||
isHelper = false;
|
||||
}
|
||||
|
||||
void AchievementPopup::permanent(Achievement *ach)
|
||||
{
|
||||
title = ach->name;
|
||||
desc = ach->getDescription();
|
||||
|
||||
startTime = System::currentTimeMillis() - 2500;
|
||||
this->ach = ach;
|
||||
isHelper = true;
|
||||
}
|
||||
|
||||
void AchievementPopup::prepareWindow()
|
||||
{
|
||||
glViewport(0, 0, mc->width, mc->height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
this->width = mc->width;
|
||||
this->height = mc->height;
|
||||
|
||||
ScreenSizeCalculator ssc(mc->options, mc->width, mc->height);
|
||||
width = ssc.getWidth();
|
||||
height = ssc.getHeight();
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, (float)width, (float)height, 0, 1000, 3000);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -2000);
|
||||
|
||||
}
|
||||
|
||||
void AchievementPopup::render()
|
||||
{
|
||||
// 4J Unused
|
||||
#if 0
|
||||
if (Minecraft::warezTime > 0)
|
||||
{
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(false);
|
||||
Lighting::turnOff();
|
||||
prepareWindow();
|
||||
|
||||
wstring title = L"Minecraft " + SharedConstants::VERSION_STRING + L" Unlicensed Copy :(";
|
||||
wstring msg1 = L"(Or logged in from another location)";
|
||||
wstring msg2 = L"Purchase at minecraft.net";
|
||||
|
||||
mc->font->drawShadow(title, 2, 2 + 9 * 0, 0xffffff);
|
||||
mc->font->drawShadow(msg1, 2, 2 + 9 * 1, 0xffffff);
|
||||
mc->font->drawShadow(msg2, 2, 2 + 9 * 2, 0xffffff);
|
||||
|
||||
glDepthMask(true);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
if (ach == NULL || startTime == 0) return;
|
||||
|
||||
double time = (System::currentTimeMillis() - startTime) / 3000.0;
|
||||
if (isHelper)
|
||||
{
|
||||
}
|
||||
else if (!isHelper && (time < 0 || time > 1))
|
||||
{
|
||||
startTime = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
prepareWindow();
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(false);
|
||||
|
||||
double yo = time * 2;
|
||||
if (yo > 1) yo = 2 - yo;
|
||||
yo = yo * 4;
|
||||
yo = 1 - yo;
|
||||
if (yo < 0) yo = 0;
|
||||
yo = yo * yo;
|
||||
yo = yo * yo;
|
||||
|
||||
int xx = width - 160;
|
||||
int yy = 0 - (int) (yo * 36);
|
||||
int tex = mc->textures->loadTexture(L"/achievement/bg.png");
|
||||
glColor4f(1, 1, 1, 1);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
blit(xx, yy, 96, 202, 160, 32);
|
||||
|
||||
if (isHelper)
|
||||
{
|
||||
mc->font->drawWordWrap(desc, xx + 30, yy + 7, 120, 0xffffffff);
|
||||
}
|
||||
else
|
||||
{
|
||||
mc->font->draw(title, xx + 30, yy + 7, 0xffffff00);
|
||||
mc->font->draw(desc, xx + 30, yy + 18, 0xffffffff);
|
||||
}
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(180, 1, 0, 0);
|
||||
Lighting::turnOn();
|
||||
glPopMatrix();
|
||||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
ir->renderGuiItem(mc->font, mc->textures, ach->icon, xx + 8, yy + 8);
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
glDepthMask(true);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
#endif
|
||||
}
|
||||
28
Minecraft.Client/AchievementPopup.h
Normal file
28
Minecraft.Client/AchievementPopup.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
#include "GuiComponent.h"
|
||||
class Achievement;
|
||||
class ItemRenderer;
|
||||
using namespace std;
|
||||
|
||||
class AchievementPopup : public GuiComponent
|
||||
{
|
||||
private:
|
||||
Minecraft *mc;
|
||||
int width, height;
|
||||
|
||||
wstring title;
|
||||
wstring desc;
|
||||
Achievement *ach;
|
||||
__int64 startTime;
|
||||
ItemRenderer *ir;
|
||||
bool isHelper;
|
||||
|
||||
public:
|
||||
AchievementPopup(Minecraft *mc);
|
||||
void popup(Achievement *ach);
|
||||
void permanent(Achievement *ach);
|
||||
private:
|
||||
void prepareWindow();
|
||||
public:
|
||||
void render();
|
||||
};
|
||||
426
Minecraft.Client/AchievementScreen.cpp
Normal file
426
Minecraft.Client/AchievementScreen.cpp
Normal file
|
|
@ -0,0 +1,426 @@
|
|||
#include "stdafx.h"
|
||||
#include "AchievementScreen.h"
|
||||
#include "SmallButton.h"
|
||||
#include "Options.h"
|
||||
#include "KeyMapping.h"
|
||||
#include "Font.h"
|
||||
#include "Lighting.h"
|
||||
#include "Textures.h"
|
||||
#include "StatsCounter.h"
|
||||
#include "ItemRenderer.h"
|
||||
#include "..\Minecraft.World\System.h"
|
||||
#include "..\Minecraft.World\net.minecraft.locale.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
|
||||
#include "..\Minecraft.World\JavaMath.h"
|
||||
|
||||
|
||||
|
||||
AchievementScreen::AchievementScreen(StatsCounter *statsCounter)
|
||||
{
|
||||
// 4J - added initialisers
|
||||
imageWidth = 256;
|
||||
imageHeight = 202;
|
||||
xLastScroll = 0;
|
||||
yLastScroll = 0;
|
||||
scrolling = 0;
|
||||
|
||||
// 4J - TODO - investigate - these were static final ints before, but based on members of Achievements which
|
||||
// aren't final Or actually initialised
|
||||
xMin = Achievements::xMin * ACHIEVEMENT_COORD_SCALE - BIGMAP_WIDTH / 2;
|
||||
yMin = Achievements::yMin * ACHIEVEMENT_COORD_SCALE - BIGMAP_WIDTH / 2;
|
||||
xMax = Achievements::xMax * ACHIEVEMENT_COORD_SCALE - BIGMAP_HEIGHT / 2;
|
||||
yMax = Achievements::yMax * ACHIEVEMENT_COORD_SCALE - BIGMAP_HEIGHT / 2;
|
||||
|
||||
this->statsCounter = statsCounter;
|
||||
int wBigMap = 141;
|
||||
int hBigMap = 141;
|
||||
|
||||
xScrollO = xScrollP = xScrollTarget = Achievements::openInventory->x * ACHIEVEMENT_COORD_SCALE - wBigMap / 2 - 12;
|
||||
yScrollO = yScrollP = yScrollTarget = Achievements::openInventory->y * ACHIEVEMENT_COORD_SCALE - hBigMap / 2;
|
||||
|
||||
}
|
||||
|
||||
void AchievementScreen::init()
|
||||
{
|
||||
buttons.clear();
|
||||
// buttons.add(new SmallButton(0, width / 2 - 80 - 24, height / 2 + 74, 110, 20, I18n.get("gui.achievements")));
|
||||
buttons.push_back(new SmallButton(1, width / 2 + 24, height / 2 + 74, 80, 20, I18n::get(L"gui.done")));
|
||||
|
||||
}
|
||||
|
||||
void AchievementScreen::buttonClicked(Button *button)
|
||||
{
|
||||
if (button->id == 1)
|
||||
{
|
||||
minecraft->setScreen(NULL);
|
||||
// minecraft->grabMouse(); // 4J removed
|
||||
}
|
||||
Screen::buttonClicked(button);
|
||||
}
|
||||
|
||||
void AchievementScreen::keyPressed(char eventCharacter, int eventKey)
|
||||
{
|
||||
if (eventKey == minecraft->options->keyBuild->key)
|
||||
{
|
||||
minecraft->setScreen(NULL);
|
||||
// minecraft->grabMouse(); // 4J removed
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen::keyPressed(eventCharacter, eventKey);
|
||||
}
|
||||
}
|
||||
|
||||
void AchievementScreen::render(int mouseX, int mouseY, float a)
|
||||
{
|
||||
if (Mouse::isButtonDown(0))
|
||||
{
|
||||
int xo = (width - imageWidth) / 2;
|
||||
int yo = (height - imageHeight) / 2;
|
||||
|
||||
int xBigMap = xo + 8;
|
||||
int yBigMap = yo + 17;
|
||||
|
||||
if (scrolling == 0 || scrolling == 1)
|
||||
{
|
||||
if (mouseX >= xBigMap && mouseX < xBigMap + BIGMAP_WIDTH && mouseY >= yBigMap && mouseY < yBigMap + BIGMAP_HEIGHT)
|
||||
{
|
||||
if (scrolling == 0)
|
||||
{
|
||||
scrolling = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
xScrollP -= mouseX - xLastScroll;
|
||||
yScrollP -= mouseY - yLastScroll;
|
||||
xScrollTarget = xScrollO = xScrollP;
|
||||
yScrollTarget = yScrollO = yScrollP;
|
||||
}
|
||||
xLastScroll = mouseX;
|
||||
yLastScroll = mouseY;
|
||||
}
|
||||
}
|
||||
|
||||
if (xScrollTarget < xMin) xScrollTarget = xMin;
|
||||
if (yScrollTarget < yMin) yScrollTarget = yMin;
|
||||
if (xScrollTarget >= xMax) xScrollTarget = xMax - 1;
|
||||
if (yScrollTarget >= yMax) yScrollTarget = yMax - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
scrolling = 0;
|
||||
}
|
||||
|
||||
renderBackground();
|
||||
|
||||
renderBg(mouseX, mouseY, a);
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
renderLabels();
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
}
|
||||
|
||||
void AchievementScreen::tick()
|
||||
{
|
||||
xScrollO = xScrollP;
|
||||
yScrollO = yScrollP;
|
||||
|
||||
double xd = (xScrollTarget - xScrollP);
|
||||
double yd = (yScrollTarget - yScrollP);
|
||||
if (xd * xd + yd * yd < 4)
|
||||
{
|
||||
xScrollP += xd;
|
||||
yScrollP += yd;
|
||||
}
|
||||
else
|
||||
{
|
||||
xScrollP += xd * 0.85;
|
||||
yScrollP += yd * 0.85;
|
||||
}
|
||||
}
|
||||
|
||||
void AchievementScreen::renderLabels()
|
||||
{
|
||||
int xo = (width - imageWidth) / 2;
|
||||
int yo = (height - imageHeight) / 2;
|
||||
font->draw(L"Achievements", xo + 15, yo + 5, 0x404040);
|
||||
|
||||
// font.draw(xScrollP + ", " + yScrollP, xo + 5, yo + 5 + BIGMAP_HEIGHT + 18, 0x404040);
|
||||
// font.drawWordWrap("Ride a pig off a cliff.", xo + 5, yo + 5 + BIGMAP_HEIGHT + 16, BIGMAP_WIDTH, 0x404040);
|
||||
|
||||
}
|
||||
|
||||
void AchievementScreen::renderBg(int xm, int ym, float a)
|
||||
{
|
||||
// 4J Unused
|
||||
#if 0
|
||||
int xScroll = Mth::floor(xScrollO + (xScrollP - xScrollO) * a);
|
||||
int yScroll = Mth::floor(yScrollO + (yScrollP - yScrollO) * a);
|
||||
|
||||
if (xScroll < xMin) xScroll = xMin;
|
||||
if (yScroll < yMin) yScroll = yMin;
|
||||
if (xScroll >= xMax) xScroll = xMax - 1;
|
||||
if (yScroll >= yMax) yScroll = yMax - 1;
|
||||
|
||||
|
||||
int terrainTex = minecraft->textures->loadTexture(L"/terrain.png");
|
||||
int tex = minecraft->textures->loadTexture(L"/achievement/bg.png");
|
||||
|
||||
int xo = (width - imageWidth) / 2;
|
||||
int yo = (height - imageHeight) / 2;
|
||||
|
||||
int xBigMap = xo + BIGMAP_X;
|
||||
int yBigMap = yo + BIGMAP_Y;
|
||||
|
||||
blitOffset = 0;
|
||||
// glDisable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_GEQUAL);
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 0, -200);
|
||||
|
||||
{
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
minecraft->textures->bind(terrainTex);
|
||||
|
||||
int leftTile = (xScroll + EDGE_VALUE_X) >> 4;
|
||||
int topTile = (yScroll + EDGE_VALUE_Y) >> 4;
|
||||
int xMod = (xScroll + EDGE_VALUE_X) % 16;
|
||||
int yMod = (yScroll + EDGE_VALUE_Y) % 16;
|
||||
|
||||
const int rockLevel = (Achievements::ACHIEVEMENT_HEIGHT_POSITION * 4) / 10;
|
||||
const int coalLevel = (Achievements::ACHIEVEMENT_HEIGHT_POSITION * 7) / 10;
|
||||
const int ironLevel = (Achievements::ACHIEVEMENT_HEIGHT_POSITION * 9) / 10;
|
||||
const int diamondLevel = (Achievements::ACHIEVEMENT_HEIGHT_POSITION * 19) / 10;
|
||||
const int bedrockLevel = (Achievements::ACHIEVEMENT_HEIGHT_POSITION * 31) / 10;
|
||||
|
||||
Random *random = new Random();
|
||||
|
||||
for (int tileY = 0; (tileY * 16) - yMod < BIGMAP_HEIGHT; tileY++)
|
||||
{
|
||||
|
||||
float amount = .6f - (float) (topTile + tileY) / (float) (Achievements::ACHIEVEMENT_HEIGHT_POSITION * 2 + 1) * .3f;
|
||||
glColor4f(amount, amount, amount, 1);
|
||||
|
||||
for (int tileX = 0; (tileX * 16) - xMod < BIGMAP_WIDTH; tileX++)
|
||||
{
|
||||
|
||||
random->setSeed(1234 + leftTile + tileX);
|
||||
random->nextInt();
|
||||
int heightValue = random->nextInt(1 + topTile + tileY) + (topTile + tileY) / 2;
|
||||
int tileType = Tile::sand->tex;
|
||||
|
||||
if (heightValue > bedrockLevel || (topTile + tileY) == MAX_BG_TILE_Y)
|
||||
{
|
||||
tileType = Tile::unbreakable->tex;
|
||||
}
|
||||
else if (heightValue == diamondLevel)
|
||||
{
|
||||
if (random->nextInt(2) == 0)
|
||||
{
|
||||
tileType = Tile::diamondOre->tex;
|
||||
}
|
||||
else
|
||||
{
|
||||
tileType = Tile::redStoneOre->tex;
|
||||
}
|
||||
}
|
||||
else if (heightValue == ironLevel)
|
||||
{
|
||||
tileType = Tile::ironOre->tex;
|
||||
}
|
||||
else if (heightValue == coalLevel)
|
||||
{
|
||||
tileType = Tile::coalOre->tex;
|
||||
}
|
||||
else if (heightValue > rockLevel)
|
||||
{
|
||||
tileType = Tile::rock->tex;
|
||||
}
|
||||
else if (heightValue > 0)
|
||||
{
|
||||
tileType = Tile::dirt->tex;
|
||||
}
|
||||
|
||||
this->blit(xBigMap + tileX * 16 - xMod, yBigMap + tileY * 16 - yMod, (tileType % 16) << 4, (tileType >> 4) << 4, 16, 16);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
AUTO_VAR(itEnd, Achievements::achievements->end());
|
||||
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
|
||||
{
|
||||
Achievement *ach = *it; //Achievements::achievements->at(i);
|
||||
if (ach->requires == NULL) continue;
|
||||
|
||||
int x1 = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll + 11 + xBigMap;
|
||||
int y1 = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll + 11 + yBigMap;
|
||||
|
||||
int x2 = ach->requires->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll + 11 + xBigMap;
|
||||
int y2 = ach->requires->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll + 11 + yBigMap;
|
||||
|
||||
int color = 0;
|
||||
|
||||
bool taken = statsCounter->hasTaken(ach);
|
||||
bool canTake = statsCounter->canTake(ach);
|
||||
|
||||
int alph = (int) (sin(System::currentTimeMillis() % 600 / 600.0 * PI * 2) > 0.6 ? 255 : 130);
|
||||
if (taken) color = 0xff707070;
|
||||
else if (canTake) color = 0x00ff00 + (alph << 24);
|
||||
else color = 0xff000000;
|
||||
|
||||
hLine(x1, x2, y1, color);
|
||||
vLine(x2, y1, y2, color);
|
||||
}
|
||||
|
||||
Achievement *hoveredAchievement = NULL;
|
||||
ItemRenderer *ir = new ItemRenderer();
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(180, 1, 0, 0);
|
||||
Lighting::turnOn();
|
||||
glPopMatrix();
|
||||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
itEnd = Achievements::achievements->end();
|
||||
for (AUTO_VAR(it, Achievements::achievements->begin()); it != itEnd; it++)
|
||||
{
|
||||
Achievement *ach = *it; //Achievements::achievements->at(i);
|
||||
|
||||
int x = ach->x * ACHIEVEMENT_COORD_SCALE - (int) xScroll;
|
||||
int y = ach->y * ACHIEVEMENT_COORD_SCALE - (int) yScroll;
|
||||
|
||||
if (x >= -24 && y >= -24 && x <= BIGMAP_WIDTH && y <= BIGMAP_HEIGHT)
|
||||
{
|
||||
|
||||
if (statsCounter->hasTaken(ach))
|
||||
{
|
||||
float br = 1.0f;
|
||||
glColor4f(br, br, br, 1);
|
||||
}
|
||||
else if (statsCounter->canTake(ach))
|
||||
{
|
||||
float br = (sin(System::currentTimeMillis() % 600 / 600.0 * PI * 2) < 0.6 ? 0.6f : 0.8f);
|
||||
glColor4f(br, br, br, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
float br = 0.3f;
|
||||
glColor4f(br, br, br, 1);
|
||||
}
|
||||
|
||||
minecraft->textures->bind(tex);
|
||||
int xx = xBigMap + x;
|
||||
int yy = yBigMap + y;
|
||||
if (ach->isGolden())
|
||||
{
|
||||
this->blit(xx - 2, yy - 2, 26, 202, 26, 26);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->blit(xx - 2, yy - 2, 0, 202, 26, 26);
|
||||
}
|
||||
|
||||
if (!statsCounter->canTake(ach))
|
||||
{
|
||||
float br = 0.1f;
|
||||
glColor4f(br, br, br, 1);
|
||||
ir->setColor = false;
|
||||
}
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_CULL_FACE);
|
||||
ir->renderGuiItem(minecraft->font, minecraft->textures, ach->icon, xx + 3, yy + 3);
|
||||
glDisable(GL_LIGHTING);
|
||||
if (!statsCounter->canTake(ach))
|
||||
{
|
||||
ir->setColor = true;
|
||||
}
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
|
||||
if (xm >= xBigMap && ym >= yBigMap && xm < xBigMap + BIGMAP_WIDTH && ym < yBigMap + BIGMAP_HEIGHT && xm >= xx && xm <= xx + 22 && ym >= yy && ym <= yy + 22) {
|
||||
hoveredAchievement = ach;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_BLEND);
|
||||
glColor4f(1, 1, 1, 1);
|
||||
minecraft->textures->bind(tex);
|
||||
blit(xo, yo, 0, 0, imageWidth, imageHeight);
|
||||
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
blitOffset = 0;
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
Screen::render(xm, ym, a);
|
||||
|
||||
if (hoveredAchievement != NULL)
|
||||
{
|
||||
Achievement *ach = hoveredAchievement;
|
||||
wstring name = ach->name;
|
||||
wstring descr = ach->getDescription();
|
||||
|
||||
int x = xm + 12;
|
||||
int y = ym - 4;
|
||||
|
||||
if (statsCounter->canTake(ach))
|
||||
{
|
||||
int width = Math::_max(font->width(name), 120);
|
||||
int height = font->wordWrapHeight(descr, width);
|
||||
if (statsCounter->hasTaken(ach))
|
||||
{
|
||||
height += 12;
|
||||
}
|
||||
fillGradient(x - 3, y - 3, x + width + 3, y + height + 3 + 12, 0xc0000000, 0xc0000000);
|
||||
|
||||
font->drawWordWrap(descr, x, y + 12, width, 0xffa0a0a0);
|
||||
if (statsCounter->hasTaken(ach))
|
||||
{
|
||||
font->drawShadow(I18n::get(L"achievement.taken"), x, y + height + 4, 0xff9090ff);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int width = Math::_max(font->width(name), 120);
|
||||
wstring msg = I18n::get(L"achievement.requires", ach->requires->name);
|
||||
int height = font->wordWrapHeight(msg, width);
|
||||
fillGradient(x - 3, y - 3, x + width + 3, y + height + 12 + 3, 0xc0000000, 0xc0000000);
|
||||
font->drawWordWrap(msg, x, y + 12, width, 0xff705050);
|
||||
}
|
||||
font->drawShadow(name, x, y, statsCounter->canTake(ach) ? ach->isGolden() ? 0xffffff80 : 0xffffffff : ach->isGolden() ? 0xff808040 : 0xff808080);
|
||||
|
||||
|
||||
}
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
Lighting::turnOff();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool AchievementScreen::isPauseScreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
57
Minecraft.Client/AchievementScreen.h
Normal file
57
Minecraft.Client/AchievementScreen.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#pragma once
|
||||
#include "Screen.h"
|
||||
#include "..\Minecraft.World\net.minecraft.stats.h"
|
||||
class StatsCounter;
|
||||
|
||||
class AchievementScreen : public Screen
|
||||
{
|
||||
private:
|
||||
static const int BIGMAP_X = 16;
|
||||
static const int BIGMAP_Y = 17;
|
||||
static const int BIGMAP_WIDTH = 224;
|
||||
static const int BIGMAP_HEIGHT = 155;
|
||||
|
||||
// number of pixels per achievement
|
||||
static const int ACHIEVEMENT_COORD_SCALE = 24;
|
||||
static const int EDGE_VALUE_X = Achievements::ACHIEVEMENT_WIDTH_POSITION * ACHIEVEMENT_COORD_SCALE;
|
||||
static const int EDGE_VALUE_Y = Achievements::ACHIEVEMENT_HEIGHT_POSITION * ACHIEVEMENT_COORD_SCALE;
|
||||
|
||||
int xMin;
|
||||
int yMin;
|
||||
int xMax;
|
||||
int yMax;
|
||||
|
||||
static const int MAX_BG_TILE_Y = (EDGE_VALUE_Y * 2 - 1) / 16;
|
||||
|
||||
protected:
|
||||
int imageWidth;
|
||||
int imageHeight;
|
||||
int xLastScroll;
|
||||
int yLastScroll;
|
||||
|
||||
protected:
|
||||
double xScrollO, yScrollO;
|
||||
double xScrollP, yScrollP;
|
||||
double xScrollTarget, yScrollTarget;
|
||||
|
||||
private:
|
||||
int scrolling;
|
||||
StatsCounter *statsCounter;
|
||||
|
||||
public:
|
||||
using Screen::keyPressed;
|
||||
|
||||
AchievementScreen(StatsCounter *statsCounter);
|
||||
virtual void init();
|
||||
protected:
|
||||
virtual void buttonClicked(Button *button);
|
||||
virtual void keyPressed(char eventCharacter, int eventKey);
|
||||
public:
|
||||
virtual void render(int mouseX, int mouseY, float a);
|
||||
virtual void tick();
|
||||
protected:
|
||||
virtual void renderLabels();
|
||||
virtual void renderBg(int xm, int ym, float a);
|
||||
public:
|
||||
virtual bool isPauseScreen();
|
||||
};
|
||||
21
Minecraft.Client/AllowAllCuller.cpp
Normal file
21
Minecraft.Client/AllowAllCuller.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "stdafx.h"
|
||||
#include "AllowAllCuller.h"
|
||||
|
||||
bool AllowAllCuller::isVisible(AABB *bb)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AllowAllCuller::cubeInFrustum(double x0, double y0, double z0, double x1, double y1, double z1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AllowAllCuller::cubeFullyInFrustum(double x0, double y0, double z0, double x1, double y1, double z1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AllowAllCuller::prepare(double xOff, double yOff, double zOff)
|
||||
{
|
||||
}
|
||||
11
Minecraft.Client/AllowAllCuller.h
Normal file
11
Minecraft.Client/AllowAllCuller.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include "Culler.h"
|
||||
|
||||
class AllowAllCuller
|
||||
{
|
||||
public:
|
||||
virtual bool isVisible(AABB *bb);
|
||||
virtual bool cubeInFrustum(double x0, double y0, double z0, double x1, double y1, double z1);
|
||||
virtual bool cubeFullyInFrustum(double x0, double y0, double z0, double x1, double y1, double z1);
|
||||
virtual void prepare(double xOff, double yOff, double zOff);
|
||||
};
|
||||
215
Minecraft.Client/ArchiveFile.cpp
Normal file
215
Minecraft.Client/ArchiveFile.cpp
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
#include "..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\Minecraft.World\compression.h"
|
||||
|
||||
#include "ArchiveFile.h"
|
||||
|
||||
void ArchiveFile::_readHeader(DataInputStream *dis)
|
||||
{
|
||||
int numberOfFiles = dis->readInt();
|
||||
|
||||
for (int i = 0; i < numberOfFiles; i++)
|
||||
{
|
||||
MetaData *meta = new MetaData();
|
||||
meta->filename = dis->readUTF();
|
||||
meta->ptr = dis->readInt();
|
||||
meta->filesize = dis->readInt();
|
||||
|
||||
// Filenames preceeded by an asterisk have been compressed.
|
||||
if (meta->filename[0] == '*')
|
||||
{
|
||||
meta->filename = meta->filename.substr(1);
|
||||
meta->isCompressed = true;
|
||||
}
|
||||
else meta->isCompressed = false;
|
||||
|
||||
m_index.insert( pair<wstring,PMetaData>(meta->filename,meta) );
|
||||
}
|
||||
}
|
||||
|
||||
ArchiveFile::ArchiveFile(File file)
|
||||
{
|
||||
m_cachedData = NULL;
|
||||
m_sourcefile = file;
|
||||
app.DebugPrintf("Loading archive file...\n");
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
char buf[256];
|
||||
wcstombs(buf, file.getPath().c_str(), 256);
|
||||
app.DebugPrintf("archive file - %s\n",buf);
|
||||
#endif
|
||||
|
||||
if(!file.exists())
|
||||
{
|
||||
app.DebugPrintf("Failed to load archive file!\n");//,file.getPath());
|
||||
app.FatalLoadError();
|
||||
}
|
||||
|
||||
FileInputStream fis(file);
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||
byteArray readArray(file.length());
|
||||
fis.read(readArray,0,file.length());
|
||||
|
||||
ByteArrayInputStream bais(readArray);
|
||||
DataInputStream dis(&bais);
|
||||
|
||||
m_cachedData = readArray.data;
|
||||
#else
|
||||
DataInputStream dis(&fis);
|
||||
#endif
|
||||
|
||||
_readHeader(&dis);
|
||||
|
||||
dis.close();
|
||||
fis.close();
|
||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||
bais.reset();
|
||||
#endif
|
||||
app.DebugPrintf("Finished loading archive file\n");
|
||||
}
|
||||
|
||||
ArchiveFile::~ArchiveFile()
|
||||
{
|
||||
delete m_cachedData;
|
||||
}
|
||||
|
||||
vector<wstring> *ArchiveFile::getFileList()
|
||||
{
|
||||
vector<wstring> *out = new vector<wstring>();
|
||||
|
||||
for ( AUTO_VAR(it, m_index.begin());
|
||||
it != m_index.end();
|
||||
it++ )
|
||||
|
||||
out->push_back( it->first );
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
bool ArchiveFile::hasFile(const wstring &filename)
|
||||
{
|
||||
return m_index.find(filename) != m_index.end();
|
||||
}
|
||||
|
||||
int ArchiveFile::getFileSize(const wstring &filename)
|
||||
{
|
||||
return hasFile(filename) ? m_index.at(filename)->filesize : -1;
|
||||
}
|
||||
|
||||
byteArray ArchiveFile::getFile(const wstring &filename)
|
||||
{
|
||||
byteArray out;
|
||||
AUTO_VAR(it,m_index.find(filename));
|
||||
|
||||
if(it == m_index.end())
|
||||
{
|
||||
app.DebugPrintf("Couldn't find file in archive\n");
|
||||
app.DebugPrintf("Failed to find file '%ls' in archive\n", filename.c_str());
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
__debugbreak();
|
||||
#endif
|
||||
app.FatalLoadError();
|
||||
}
|
||||
else
|
||||
{
|
||||
PMetaData data = it->second;
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||
out = byteArray(data->filesize );
|
||||
|
||||
memcpy( out.data, m_cachedData + data->ptr, data->filesize );
|
||||
#else
|
||||
|
||||
#ifdef _UNICODE
|
||||
HANDLE hfile = CreateFile( m_sourcefile.getPath().c_str(),
|
||||
GENERIC_READ,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL
|
||||
);
|
||||
#else
|
||||
app.DebugPrintf("Createfile archive\n");
|
||||
HANDLE hfile = CreateFile( wstringtofilename(m_sourcefile.getPath()),
|
||||
GENERIC_READ,
|
||||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL
|
||||
);
|
||||
#endif
|
||||
|
||||
if (hfile != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
app.DebugPrintf("hfile ok\n");
|
||||
DWORD ok = SetFilePointer( hfile,
|
||||
data->ptr,
|
||||
NULL,
|
||||
FILE_BEGIN
|
||||
);
|
||||
|
||||
if (ok != INVALID_SET_FILE_POINTER)
|
||||
{
|
||||
PBYTE pbData = new BYTE[ data->filesize ];
|
||||
|
||||
DWORD bytesRead = -1;
|
||||
BOOL bSuccess = ReadFile( hfile,
|
||||
(LPVOID) pbData,
|
||||
data->filesize,
|
||||
&bytesRead,
|
||||
NULL
|
||||
);
|
||||
|
||||
if(bSuccess==FALSE)
|
||||
{
|
||||
app.FatalLoadError();
|
||||
}
|
||||
assert(bytesRead == data->filesize);
|
||||
out = byteArray(pbData, data->filesize);
|
||||
}
|
||||
else
|
||||
{
|
||||
app.FatalLoadError();
|
||||
}
|
||||
|
||||
CloseHandle(hfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
app.DebugPrintf("bad hfile\n");
|
||||
app.FatalLoadError();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Compressed filenames are preceeded with an asterisk.
|
||||
if ( data->isCompressed && out.data != NULL )
|
||||
{
|
||||
/* 4J-JEV:
|
||||
* If a compressed file is accessed before compression object is
|
||||
* initialized it will crash here (Compression::getCompression).
|
||||
*/
|
||||
///4 279 553 556
|
||||
|
||||
ByteArrayInputStream bais(out);
|
||||
DataInputStream dis(&bais);
|
||||
unsigned int decompressedSize = dis.readInt();
|
||||
dis.close();
|
||||
|
||||
PBYTE uncompressedBuffer = new BYTE[decompressedSize];
|
||||
Compression::getCompression()->Decompress(uncompressedBuffer, &decompressedSize, out.data+4, out.length-4);
|
||||
|
||||
delete [] out.data;
|
||||
|
||||
out.data = uncompressedBuffer;
|
||||
out.length = decompressedSize;
|
||||
}
|
||||
|
||||
assert(out.data != NULL); // THERE IS NO FILE WITH THIS NAME!
|
||||
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
38
Minecraft.Client/ArchiveFile.h
Normal file
38
Minecraft.Client/ArchiveFile.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "..\Minecraft.World\File.h"
|
||||
#include "..\Minecraft.World\ArrayWithLength.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class ArchiveFile
|
||||
{
|
||||
protected:
|
||||
File m_sourcefile;
|
||||
BYTE *m_cachedData;
|
||||
|
||||
typedef struct _MetaData
|
||||
{
|
||||
wstring filename;
|
||||
int ptr;
|
||||
int filesize;
|
||||
bool isCompressed;
|
||||
|
||||
} MetaData, *PMetaData;
|
||||
|
||||
unordered_map<wstring, PMetaData> m_index;
|
||||
|
||||
public:
|
||||
void _readHeader(DataInputStream *dis);
|
||||
|
||||
ArchiveFile(File file);
|
||||
~ArchiveFile();
|
||||
|
||||
vector<wstring> *getFileList();
|
||||
bool hasFile(const wstring &filename);
|
||||
int getFileSize(const wstring &filename);
|
||||
byteArray getFile(const wstring &filename);
|
||||
};
|
||||
86
Minecraft.Client/ArrowRenderer.cpp
Normal file
86
Minecraft.Client/ArrowRenderer.cpp
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
#include "stdafx.h"
|
||||
#include "ArrowRenderer.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
|
||||
#include "..\Minecraft.World\Mth.h"
|
||||
|
||||
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"
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
float yRot = arrow->yRot;
|
||||
float xRot = arrow->xRot;
|
||||
float yRotO = arrow->yRotO;
|
||||
float xRotO = arrow->xRotO;
|
||||
if( ( yRot - yRotO ) > 180.0f ) yRot -= 360.0f;
|
||||
else if( ( yRot - yRotO ) < -180.0f ) yRot += 360.0f;
|
||||
if( ( xRot - xRotO ) > 180.0f ) xRot -= 360.0f;
|
||||
else if( ( xRot - xRotO ) < -180.0f ) xRot += 360.0f;
|
||||
|
||||
glTranslatef((float)x, (float)y, (float)z);
|
||||
glRotatef(yRotO + (yRot - yRotO) * a - 90, 0, 1, 0);
|
||||
glRotatef(xRotO + (xRot - xRotO) * a, 0, 0, 1);
|
||||
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
int type = 0;
|
||||
|
||||
float u0 = 0 / 32.0f;
|
||||
float u1 = 16 / 32.0f;
|
||||
float v0 = (0 + type * 10) / 32.0f;
|
||||
float v1 = (5 + type * 10) / 32.0f;
|
||||
|
||||
float u02 = 0 / 32.0f;
|
||||
float u12 = 5 / 32.0f;
|
||||
float v02 = (5 + type * 10) / 32.0f;
|
||||
float v12 = (10 + type * 10) / 32.0f;
|
||||
float ss = 0.9f / 16.0f;
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
float shake = arrow->shakeTime-a;
|
||||
if (shake>0)
|
||||
{
|
||||
float pow = -Mth::sin(shake*3)*shake;
|
||||
glRotatef(pow, 0, 0, 1);
|
||||
}
|
||||
glRotatef(45, 1, 0, 0);
|
||||
glScalef(ss, ss, ss);
|
||||
|
||||
glTranslatef(-4, 0, 0);
|
||||
|
||||
// glNormal3f(ss, 0, 0); // 4J - changed to use tesselator
|
||||
t->begin();
|
||||
t->normal(1,0,0);
|
||||
t->vertexUV((float)(-7), (float)( -2), (float)( -2), (float)( u02), (float)( v02));
|
||||
t->vertexUV((float)(-7), (float)( -2), (float)( +2), (float)( u12), (float)( v02));
|
||||
t->vertexUV((float)(-7), (float)( +2), (float)( +2), (float)( u12), (float)( v12));
|
||||
t->vertexUV((float)(-7), (float)( +2), (float)( -2), (float)( u02), (float)( v12));
|
||||
t->end();
|
||||
|
||||
// glNormal3f(-ss, 0, 0); // 4J - changed to use tesselator
|
||||
t->begin();
|
||||
t->normal(-1,0,0);
|
||||
t->vertexUV((float)(-7), (float)( +2), (float)( -2), (float)( u02), (float)( v02));
|
||||
t->vertexUV((float)(-7), (float)( +2), (float)( +2), (float)( u12), (float)( v02));
|
||||
t->vertexUV((float)(-7), (float)( -2), (float)( +2), (float)( u12), (float)( v12));
|
||||
t->vertexUV((float)(-7), (float)( -2), (float)( -2), (float)( u02), (float)( v12));
|
||||
t->end();
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
glRotatef(90, 1, 0, 0);
|
||||
// glNormal3f(0, 0, ss); // 4J - changed to use tesselator
|
||||
t->begin();
|
||||
t->normal(0,0,1);
|
||||
t->vertexUV((float)(-8), (float)( -2), (float)( 0), (float)( u0), (float)( v0));
|
||||
t->vertexUV((float)(+8), (float)( -2), (float)( 0), (float)( u1), (float)( v0));
|
||||
t->vertexUV((float)(+8), (float)( +2), (float)( 0), (float)( u1), (float)( v1));
|
||||
t->vertexUV((float)(-8), (float)( +2), (float)( 0), (float)( u0), (float)( v1));
|
||||
t->end();
|
||||
}
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
glPopMatrix();
|
||||
}
|
||||
8
Minecraft.Client/ArrowRenderer.h
Normal file
8
Minecraft.Client/ArrowRenderer.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
#include "EntityRenderer.h"
|
||||
|
||||
class ArrowRenderer : public EntityRenderer
|
||||
{
|
||||
public:
|
||||
virtual void render(shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a);
|
||||
};
|
||||
76
Minecraft.Client/BlazeModel.cpp
Normal file
76
Minecraft.Client/BlazeModel.cpp
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\Minecraft.World\Mth.h"
|
||||
#include "BlazeModel.h"
|
||||
#include "ModelPart.h"
|
||||
|
||||
BlazeModel::BlazeModel() : Model()
|
||||
{
|
||||
upperBodyParts = ModelPartArray(12);
|
||||
|
||||
for (unsigned int i = 0; i < upperBodyParts.length; i++)
|
||||
{
|
||||
upperBodyParts[i] = new ModelPart(this, 0, 16);
|
||||
upperBodyParts[i]->addBox(0, 0, 0, 2, 8, 2);
|
||||
}
|
||||
|
||||
head = new ModelPart(this, 0, 0);
|
||||
head->addBox(-4, -4, -4, 8, 8, 8);
|
||||
|
||||
// 4J added - compile now to avoid random performance hit first time cubes are rendered
|
||||
// 4J Stu - Not just performance, but alpha+depth tests don't work right unless we compile here
|
||||
for (unsigned int i = 0; i < upperBodyParts.length; i++)
|
||||
{
|
||||
upperBodyParts[i]->compile(1.0f/16.0f);
|
||||
}
|
||||
head->compile(1.0f/16.0f);
|
||||
}
|
||||
|
||||
int BlazeModel::modelVersion()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
void BlazeModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||
{
|
||||
setupAnim(time, r, bob, yRot, xRot, scale);
|
||||
|
||||
head->render(scale,usecompiled);
|
||||
for (unsigned int i = 0; i < upperBodyParts.length; i++)
|
||||
{
|
||||
upperBodyParts[i]->render(scale, usecompiled);
|
||||
}
|
||||
}
|
||||
|
||||
void BlazeModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim)
|
||||
{
|
||||
|
||||
float angle = bob * PI * -.1f;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
upperBodyParts[i]->y = -2 + Mth::cos((i * 2 + bob) * .25f);
|
||||
upperBodyParts[i]->x = Mth::cos(angle) * 9.0f;
|
||||
upperBodyParts[i]->z = Mth::sin(angle) * 9.0f;
|
||||
angle += PI * 0.5f;
|
||||
}
|
||||
angle = .25f * PI + bob * PI * .03f;
|
||||
for (int i = 4; i < 8; i++)
|
||||
{
|
||||
upperBodyParts[i]->y = 2 + Mth::cos((i * 2 + bob) * .25f);
|
||||
upperBodyParts[i]->x = Mth::cos(angle) * 7.0f;
|
||||
upperBodyParts[i]->z = Mth::sin(angle) * 7.0f;
|
||||
angle += PI * 0.5f;
|
||||
}
|
||||
|
||||
angle = .15f * PI + bob * PI * -.05f;
|
||||
for (int i = 8; i < 12; i++)
|
||||
{
|
||||
upperBodyParts[i]->y = 11 + Mth::cos((i * 1.5f + bob) * .5f);
|
||||
upperBodyParts[i]->x = Mth::cos(angle) * 5.0f;
|
||||
upperBodyParts[i]->z = Mth::sin(angle) * 5.0f;
|
||||
angle += PI * 0.5f;
|
||||
}
|
||||
|
||||
head->yRot = yRot / (float) (180 / PI);
|
||||
head->xRot = xRot / (float) (180 / PI);
|
||||
}
|
||||
|
||||
16
Minecraft.Client/BlazeModel.h
Normal file
16
Minecraft.Client/BlazeModel.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
#include "Model.h"
|
||||
|
||||
class BlazeModel : public Model
|
||||
{
|
||||
|
||||
private:
|
||||
ModelPartArray upperBodyParts;
|
||||
ModelPart *head;
|
||||
|
||||
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);
|
||||
};
|
||||
24
Minecraft.Client/BlazeRenderer.cpp
Normal file
24
Minecraft.Client/BlazeRenderer.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include "stdafx.h"
|
||||
#include "BlazeModel.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.entity.monster.h"
|
||||
#include "BlazeRenderer.h"
|
||||
|
||||
BlazeRenderer::BlazeRenderer() : MobRenderer(new BlazeModel(), 0.5f)
|
||||
{
|
||||
this->modelVersion = ((BlazeModel *) model)->modelVersion();
|
||||
}
|
||||
|
||||
void BlazeRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||
{
|
||||
// 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr<Entity> we have here -
|
||||
// do some casting around instead
|
||||
shared_ptr<Blaze> mob = dynamic_pointer_cast<Blaze>(_mob);
|
||||
|
||||
int modelVersion = ((BlazeModel *) model)->modelVersion();
|
||||
if (modelVersion != this->modelVersion)
|
||||
{
|
||||
this->modelVersion = modelVersion;
|
||||
model = new BlazeModel();
|
||||
}
|
||||
MobRenderer::render(mob, x, y, z, rot, a);
|
||||
}
|
||||
14
Minecraft.Client/BlazeRenderer.h
Normal file
14
Minecraft.Client/BlazeRenderer.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include "MobRenderer.h"
|
||||
|
||||
class BlazeRenderer : public MobRenderer
|
||||
{
|
||||
private:
|
||||
int modelVersion;
|
||||
|
||||
public:
|
||||
BlazeRenderer();
|
||||
|
||||
virtual void render(shared_ptr<Entity> mob, double x, double y, double z, float rot, float a);
|
||||
};
|
||||
51
Minecraft.Client/BoatModel.cpp
Normal file
51
Minecraft.Client/BoatModel.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include "stdafx.h"
|
||||
#include "BoatModel.h"
|
||||
|
||||
BoatModel::BoatModel() : Model()
|
||||
{
|
||||
cubes[0] = new ModelPart(this, 0, 8);
|
||||
cubes[1] = new ModelPart(this, 0, 0);
|
||||
cubes[2] = new ModelPart(this, 0, 0);
|
||||
cubes[3] = new ModelPart(this, 0, 0);
|
||||
cubes[4] = new ModelPart(this, 0, 0);
|
||||
|
||||
int w = 24;
|
||||
int d = 6;
|
||||
int h = 20;
|
||||
int yOff = 4;
|
||||
|
||||
cubes[0]->addBox((float)(-w / 2), (float)(-h / 2 + 2), -3, w, h - 4, 4, 0);
|
||||
cubes[0]->setPos(0, (float)(0 + yOff), 0);
|
||||
|
||||
cubes[1]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[1]->setPos((float)(-w / 2 + 1), (float)(0 + yOff), 0);
|
||||
|
||||
cubes[2]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[2]->setPos((float)(+w / 2 - 1), (float)(0 + yOff), 0);
|
||||
|
||||
cubes[3]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[3]->setPos(0, (float)(0 + yOff), (float)(-h / 2 + 1));
|
||||
|
||||
cubes[4]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
|
||||
cubes[4]->setPos(0, (float)(0 + yOff), (float)(+h / 2 - 1));
|
||||
|
||||
cubes[0]->xRot = PI / 2;
|
||||
cubes[1]->yRot = PI / 2 * 3;
|
||||
cubes[2]->yRot = PI / 2 * 1;
|
||||
cubes[3]->yRot = PI / 2 * 2;
|
||||
|
||||
// 4J added - compile now to avoid random performance hit first time cubes are rendered
|
||||
cubes[0]->compile(1.0f/16.0f);
|
||||
cubes[1]->compile(1.0f/16.0f);
|
||||
cubes[2]->compile(1.0f/16.0f);
|
||||
cubes[3]->compile(1.0f/16.0f);
|
||||
cubes[4]->compile(1.0f/16.0f);
|
||||
}
|
||||
|
||||
void BoatModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
cubes[i]->render(scale, usecompiled);
|
||||
}
|
||||
}
|
||||
11
Minecraft.Client/BoatModel.h
Normal file
11
Minecraft.Client/BoatModel.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include "Model.h"
|
||||
#include "ModelPart.h"
|
||||
|
||||
class BoatModel : public Model
|
||||
{
|
||||
public:
|
||||
ModelPart *cubes[5];
|
||||
BoatModel();
|
||||
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||
};
|
||||
41
Minecraft.Client/BoatRenderer.cpp
Normal file
41
Minecraft.Client/BoatRenderer.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include "stdafx.h"
|
||||
#include "BoatRenderer.h"
|
||||
#include "BoatModel.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.entity.item.h"
|
||||
#include "..\Minecraft.World\Mth.h"
|
||||
|
||||
BoatRenderer::BoatRenderer() : EntityRenderer()
|
||||
{
|
||||
this->shadowRadius = 0.5f;
|
||||
model = new BoatModel();
|
||||
}
|
||||
|
||||
void BoatRenderer::render(shared_ptr<Entity> _boat, double x, double y, double z, float rot, float a)
|
||||
{
|
||||
// 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr<Entity> we have here -
|
||||
// do some casting around instead
|
||||
shared_ptr<Boat> boat = dynamic_pointer_cast<Boat>(_boat);
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
glRotatef(180-rot, 0, 1, 0);
|
||||
float hurt = boat->getHurtTime() - a;
|
||||
float dmg = boat->getDamage() - a;
|
||||
if (dmg<0) dmg = 0;
|
||||
if (hurt>0)
|
||||
{
|
||||
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"
|
||||
glScalef(-1, -1, 1);
|
||||
model->render(boat, 0, 0, -0.1f, 0, 0, 1 / 16.0f, true);
|
||||
glPopMatrix();
|
||||
}
|
||||
13
Minecraft.Client/BoatRenderer.h
Normal file
13
Minecraft.Client/BoatRenderer.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
#include "EntityRenderer.h"
|
||||
|
||||
class BoatRenderer : public EntityRenderer
|
||||
{
|
||||
protected:
|
||||
Model *model;
|
||||
|
||||
public:
|
||||
BoatRenderer();
|
||||
|
||||
virtual void render(shared_ptr<Entity> boat, double x, double y, double z, float rot, float a);
|
||||
};
|
||||
68
Minecraft.Client/BookModel.cpp
Normal file
68
Minecraft.Client/BookModel.cpp
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\Minecraft.World\Mth.h"
|
||||
#include "BookModel.h"
|
||||
#include "ModelPart.h"
|
||||
|
||||
BookModel::BookModel()
|
||||
{
|
||||
leftLid = (new ModelPart(this))->texOffs(0, 0)->addBox(-6, -5, 0, 6, 10, 0);
|
||||
rightLid = (new ModelPart(this))->texOffs(16, 0)->addBox(0, -5, 0, 6, 10, 0);
|
||||
|
||||
seam = (new ModelPart(this))->texOffs(12, 0)->addBox(-1, -5, 0, 2, 10, 0);
|
||||
|
||||
// 4J - added faceMasks here to remove sides of these page boxes which end up being nearly coplanar to the cover of the book and flickering when rendering at a distance
|
||||
leftPages = (new ModelPart(this))->texOffs(0, 10)->addBoxWithMask(0, -4, -1 + 0.01f, 5, 8, 1, 47); // 4J - faceMask is binary 101111
|
||||
rightPages = (new ModelPart(this))->texOffs(12, 10)->addBoxWithMask(0, -4, -0.01f, 5, 8, 1, 31); // 4J - faceMask is binary 011111
|
||||
|
||||
flipPage1 = (new ModelPart(this))->texOffs(24, 10)->addBox(0, -4, 0, 5, 8, 0);
|
||||
flipPage2 = (new ModelPart(this))->texOffs(24, 10)->addBox(0, -4, 0, 5, 8, 0);
|
||||
|
||||
leftLid->setPos(0, 0, -1);
|
||||
rightLid->setPos(0, 0, 1);
|
||||
|
||||
seam->yRot = PI / 2;
|
||||
|
||||
// 4J added - compile now to avoid random performance hit first time cubes are rendered
|
||||
leftLid->compile(1.0f/16.0f);
|
||||
rightLid->compile(1.0f/16.0f);
|
||||
seam->compile(1.0f/16.0f);
|
||||
leftPages->compile(1.0f/16.0f);
|
||||
rightPages->compile(1.0f/16.0f);
|
||||
flipPage1->compile(1.0f/16.0f);
|
||||
flipPage2->compile(1.0f/16.0f);
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
leftLid->render(scale,usecompiled);
|
||||
rightLid->render(scale,usecompiled);
|
||||
seam->render(scale,usecompiled);
|
||||
|
||||
leftPages->render(scale,usecompiled);
|
||||
rightPages->render(scale,usecompiled);
|
||||
|
||||
flipPage1->render(scale,usecompiled);
|
||||
flipPage2->render(scale,usecompiled);
|
||||
}
|
||||
|
||||
void BookModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim)
|
||||
{
|
||||
float openness = (Mth::sin(time * 0.02f) * 0.10f + 1.25f) * yRot;
|
||||
|
||||
leftLid->yRot = PI + openness;
|
||||
rightLid->yRot = -openness;
|
||||
leftPages->yRot = +openness;
|
||||
rightPages->yRot = -openness;
|
||||
|
||||
flipPage1->yRot = +openness - openness * 2 * r;
|
||||
flipPage2->yRot = +openness - openness * 2 * bob;
|
||||
|
||||
leftPages->x = Mth::sin(openness);
|
||||
rightPages->x = Mth::sin(openness);
|
||||
flipPage1->x = Mth::sin(openness);
|
||||
flipPage2->x = Mth::sin(openness);
|
||||
}
|
||||
|
||||
16
Minecraft.Client/BookModel.h
Normal file
16
Minecraft.Client/BookModel.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
#pragma once
|
||||
#include "Model.h"
|
||||
|
||||
class BookModel : public Model
|
||||
{
|
||||
public:
|
||||
ModelPart *leftLid, *rightLid;
|
||||
ModelPart *leftPages, *rightPages;
|
||||
ModelPart *flipPage1, *flipPage2;
|
||||
ModelPart *seam;
|
||||
|
||||
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);
|
||||
};
|
||||
64
Minecraft.Client/BreakingItemParticle.cpp
Normal file
64
Minecraft.Client/BreakingItemParticle.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#include "stdafx.h"
|
||||
#include "BreakingItemParticle.h"
|
||||
#include "Tesselator.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.item.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.h"
|
||||
|
||||
void BreakingItemParticle::_init(Item *item, Textures *textures, int data)
|
||||
{
|
||||
this->setTex(textures, item->getIcon(data));
|
||||
rCol = gCol = bCol = 1.0f;
|
||||
gravity = Tile::snow->gravity;
|
||||
size /= 2;
|
||||
}
|
||||
|
||||
BreakingItemParticle::BreakingItemParticle(Level *level, double x, double y, double z, Item *item, Textures *textures, int data) : Particle(level, x, y, z, 0, 0, 0)
|
||||
{
|
||||
_init(item, textures, data);
|
||||
}
|
||||
|
||||
BreakingItemParticle::BreakingItemParticle(Level *level, double x, double y, double z, double xa, double ya, double za, Item *item, Textures *textures, int data) : Particle(level, x, y, z, 0, 0, 0)
|
||||
{
|
||||
_init(item, textures, data);
|
||||
xd *= 0.1f;
|
||||
yd *= 0.1f;
|
||||
zd *= 0.1f;
|
||||
xd += xa;
|
||||
yd += ya;
|
||||
zd += za;
|
||||
}
|
||||
|
||||
int BreakingItemParticle::getParticleTexture()
|
||||
{
|
||||
return ParticleEngine::ITEM_TEXTURE;
|
||||
}
|
||||
|
||||
void BreakingItemParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2)
|
||||
{
|
||||
float u0 = (texX + uo / 4.0f) / 16.0f;
|
||||
float u1 = u0 + 0.999f / 16.0f / 4;
|
||||
float v0 = (texY + vo / 4.0f) / 16.0f;
|
||||
float v1 = v0 + 0.999f / 16.0f / 4;
|
||||
float r = 0.1f * size;
|
||||
|
||||
if (tex != NULL)
|
||||
{
|
||||
u0 = tex->getU((uo / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
||||
u1 = tex->getU(((uo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
||||
v0 = tex->getV((vo / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
||||
v1 = tex->getV(((vo + 1) / 4.0f) * SharedConstants::WORLD_RESOLUTION);
|
||||
}
|
||||
|
||||
float x = (float) (xo + (this->x - xo) * a - xOff);
|
||||
float y = (float) (yo + (this->y - yo) * a - yOff);
|
||||
float z = (float) (zo + (this->z - zo) * a - zOff);
|
||||
float br = SharedConstants::TEXTURE_LIGHTING ? 1 : getBrightness(a); // 4J - change brought forward from 1.8.2
|
||||
t->color(br * rCol, br * gCol, br * bCol);
|
||||
|
||||
t->vertexUV((float)(x - xa * r - xa2 * r), (float)( y - ya * r), (float)( z - za * r - za2 * r), (float)( u0), (float)( v1));
|
||||
t->vertexUV((float)(x - xa * r + xa2 * r), (float)( y + ya * r), (float)( z - za * r + za2 * r), (float)( u0), (float)( v0));
|
||||
t->vertexUV((float)(x + xa * r + xa2 * r), (float)( y + ya * r), (float)( z + za * r + za2 * r), (float)( u1), (float)( v0));
|
||||
t->vertexUV((float)(x + xa * r - xa2 * r), (float)( y - ya * r), (float)( z + za * r - za2 * r), (float)( u1), (float)( v1));
|
||||
|
||||
}
|
||||
15
Minecraft.Client/BreakingItemParticle.h
Normal file
15
Minecraft.Client/BreakingItemParticle.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
#include "Particle.h"
|
||||
|
||||
class BreakingItemParticle : public Particle
|
||||
{
|
||||
// virtual eINSTANCEOF GetType(); // 4J-IB/JEV TODO needs implementation
|
||||
|
||||
public:
|
||||
virtual eINSTANCEOF GetType() { return eType_BREAKINGITEMPARTICLE; }
|
||||
void _init(Item *item, Textures *textures, int data);
|
||||
BreakingItemParticle(Level *level, double x, double y, double z, Item *item, Textures *textures, int data = 0);
|
||||
BreakingItemParticle(Level *level, double x, double y, double z, double xa, double ya, double za, Item *item, Textures *textures, int data = 0);
|
||||
virtual int getParticleTexture();
|
||||
virtual void render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2);
|
||||
};
|
||||
41
Minecraft.Client/BubbleParticle.cpp
Normal file
41
Minecraft.Client/BubbleParticle.cpp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include "stdafx.h"
|
||||
#include "BubbleParticle.h"
|
||||
#include "..\Minecraft.World\Random.h"
|
||||
#include "..\Minecraft.World\Mth.h"
|
||||
#include "..\Minecraft.World\JavaMath.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.material.h"
|
||||
|
||||
BubbleParticle::BubbleParticle(Level *level, double x, double y, double z, double xa, double ya, double za) : Particle(level, x, y, z, xa, ya, za)
|
||||
{
|
||||
rCol = 1.0f;
|
||||
gCol = 1.0f;
|
||||
bCol = 1.0f;
|
||||
setMiscTex(32);
|
||||
this->setSize(0.02f, 0.02f);
|
||||
|
||||
size = size*(random->nextFloat()*0.6f+0.2f);
|
||||
|
||||
xd = xa*0.2f+(float)(Math::random()*2-1)*0.02f;
|
||||
yd = ya*0.2f+(float)(Math::random()*2-1)*0.02f;
|
||||
zd = za*0.2f+(float)(Math::random()*2-1)*0.02f;
|
||||
|
||||
lifetime = (int) (8 / (Math::random() * 0.8 + 0.2));
|
||||
}
|
||||
|
||||
void BubbleParticle::tick()
|
||||
{
|
||||
xo = x;
|
||||
yo = y;
|
||||
zo = z;
|
||||
|
||||
yd += 0.002;
|
||||
move(xd, yd, zd);
|
||||
xd *= 0.85f;
|
||||
yd *= 0.85f;
|
||||
zd *= 0.85f;
|
||||
|
||||
if (level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)) != Material::water) remove();
|
||||
|
||||
if (lifetime-- <= 0) remove();
|
||||
}
|
||||
10
Minecraft.Client/BubbleParticle.h
Normal file
10
Minecraft.Client/BubbleParticle.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
#include "Particle.h"
|
||||
|
||||
class BubbleParticle : public Particle
|
||||
{
|
||||
public:
|
||||
virtual eINSTANCEOF GetType() { return eType_BUBBLEPARTICLE; }
|
||||
BubbleParticle(Level *level, double x, double y, double z, double xa, double ya, double za);
|
||||
virtual void tick();
|
||||
};
|
||||
400
Minecraft.Client/BufferedImage.cpp
Normal file
400
Minecraft.Client/BufferedImage.cpp
Normal file
|
|
@ -0,0 +1,400 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\Minecraft.World\StringHelpers.h"
|
||||
#include "Textures.h"
|
||||
#include "..\Minecraft.World\ArrayWithLength.h"
|
||||
#include "BufferedImage.h"
|
||||
|
||||
#ifdef _XBOX
|
||||
typedef struct
|
||||
{
|
||||
unsigned int filesz;
|
||||
unsigned short creator1;
|
||||
unsigned short creator2;
|
||||
unsigned int bmp_offset;
|
||||
unsigned int header_sz;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned short nplanes;
|
||||
unsigned short bitspp;
|
||||
unsigned int compress_type;
|
||||
unsigned int bmp_bytesz;
|
||||
int hres;
|
||||
int vres;
|
||||
unsigned int ncolors;
|
||||
unsigned int nimpcolors;
|
||||
} BITMAPINFOHEADER;
|
||||
#endif
|
||||
|
||||
BufferedImage::BufferedImage(int width,int height,int type)
|
||||
{
|
||||
data[0] = new int[width*height];
|
||||
|
||||
for( int i = 1 ; i < 10; i++ )
|
||||
{
|
||||
data[i] = NULL;
|
||||
}
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
void BufferedImage::ByteFlip4(unsigned int &data)
|
||||
{
|
||||
data = ( data >> 24 ) |
|
||||
( ( data >> 8 ) & 0x0000ff00 ) |
|
||||
( ( data << 8 ) & 0x00ff0000 ) |
|
||||
( data << 24 );
|
||||
}
|
||||
// Loads a bitmap into a buffered image - only currently supports the 2 types of 32-bit image that we've made so far
|
||||
// and determines which of these is which by the compression method. Compression method 3 is a 32-bit image with only
|
||||
// 24-bits used (ie no alpha channel) whereas method 0 is a full 32-bit image with a valid alpha channel.
|
||||
BufferedImage::BufferedImage(const wstring& File, bool filenameHasExtension /*=false*/, bool bTitleUpdateTexture /*=false*/, const wstring &drive /*=L""*/)
|
||||
{
|
||||
HRESULT hr;
|
||||
wstring wDrive;
|
||||
wstring filePath;
|
||||
filePath = File;
|
||||
|
||||
wDrive = drive;
|
||||
if(wDrive.empty())
|
||||
{
|
||||
#ifdef _XBOX
|
||||
if(bTitleUpdateTexture)
|
||||
{
|
||||
// Make the content package point to to the UPDATE: drive is needed
|
||||
#ifdef _TU_BUILD
|
||||
wDrive=L"UPDATE:\\";
|
||||
#else
|
||||
|
||||
wDrive=L"GAME:\\res\\TitleUpdate\\";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
wDrive=L"GAME:\\";
|
||||
}
|
||||
#else
|
||||
|
||||
#ifdef __PS3__
|
||||
|
||||
char *pchUsrDir;
|
||||
if(app.GetBootedFromDiscPatch())
|
||||
{
|
||||
const char *pchTextureName=wstringtofilename(File);
|
||||
pchUsrDir = app.GetBDUsrDirPath(pchTextureName);
|
||||
}
|
||||
else
|
||||
{
|
||||
pchUsrDir=getUsrDirPath();
|
||||
}
|
||||
|
||||
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
|
||||
|
||||
if(bTitleUpdateTexture)
|
||||
{
|
||||
// Make the content package point to to the UPDATE: drive is needed
|
||||
wDrive= wstr + L"\\Common\\res\\TitleUpdate\\";
|
||||
}
|
||||
else
|
||||
{
|
||||
wDrive= wstr + L"/Common/";
|
||||
}
|
||||
#elif __PSVITA__
|
||||
|
||||
/*char *pchUsrDir=getUsrDirPath();
|
||||
|
||||
wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir));
|
||||
|
||||
if(bTitleUpdateTexture)
|
||||
{
|
||||
// Make the content package point to to the UPDATE: drive is needed
|
||||
wDrive= wstr + L"\\Common\\res\\TitleUpdate\\";
|
||||
}
|
||||
else
|
||||
{
|
||||
wDrive= wstr + L"/Common/";
|
||||
}*/
|
||||
|
||||
if(bTitleUpdateTexture)
|
||||
{
|
||||
// Make the content package point to to the UPDATE: drive is needed
|
||||
wDrive= L"Common\\res\\TitleUpdate\\";
|
||||
}
|
||||
else
|
||||
{
|
||||
wDrive= L"Common/";
|
||||
}
|
||||
#else
|
||||
if(bTitleUpdateTexture)
|
||||
{
|
||||
// Make the content package point to to the UPDATE: drive is needed
|
||||
wDrive= L"Common\\res\\TitleUpdate\\";
|
||||
}
|
||||
else
|
||||
{
|
||||
wDrive= L"Common/";
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
for( int l = 0 ; l < 10; l++ )
|
||||
{
|
||||
data[l] = NULL;
|
||||
}
|
||||
|
||||
for( int l = 0; l < 10; l++ )
|
||||
{
|
||||
wstring name;
|
||||
wstring mipMapPath = L"";
|
||||
if( l != 0 )
|
||||
{
|
||||
mipMapPath = L"MipMapLevel" + _toString<int>(l+1);
|
||||
}
|
||||
if( filenameHasExtension )
|
||||
{
|
||||
name = wDrive + L"res" + filePath.substr(0,filePath.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
name = wDrive + L"res" + filePath.substr(0,filePath.length()-4) + mipMapPath + L".png";
|
||||
}
|
||||
|
||||
const char *pchTextureName=wstringtofilename(name);
|
||||
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("\n--- Loading TEXTURE - %s\n\n",pchTextureName);
|
||||
#endif
|
||||
|
||||
D3DXIMAGE_INFO ImageInfo;
|
||||
ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO));
|
||||
hr=RenderManager.LoadTextureData(pchTextureName,&ImageInfo,&data[l]);
|
||||
|
||||
|
||||
if(hr!=ERROR_SUCCESS)
|
||||
{
|
||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||
if( l == 0 )
|
||||
{
|
||||
app.FatalLoadError();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if( l == 0 )
|
||||
{
|
||||
width=ImageInfo.Width;
|
||||
height=ImageInfo.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BufferedImage::BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenameHasExtension /*= false*/ )
|
||||
{
|
||||
HRESULT hr;
|
||||
wstring filePath = File;
|
||||
BYTE *pbData = NULL;
|
||||
DWORD dwBytes = 0;
|
||||
|
||||
for( int l = 0 ; l < 10; l++ )
|
||||
{
|
||||
data[l] = NULL;
|
||||
}
|
||||
|
||||
for( int l = 0; l < 10; l++ )
|
||||
{
|
||||
wstring name;
|
||||
wstring mipMapPath = L"";
|
||||
if( l != 0 )
|
||||
{
|
||||
mipMapPath = L"MipMapLevel" + _toString<int>(l+1);
|
||||
}
|
||||
if( filenameHasExtension )
|
||||
{
|
||||
name = L"res" + filePath.substr(0,filePath.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
name = L"res" + filePath.substr(0,filePath.length()-4) + mipMapPath + L".png";
|
||||
}
|
||||
|
||||
if(!dlcPack->doesPackContainFile(DLCManager::e_DLCType_All, name))
|
||||
{
|
||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||
if( l == 0 )
|
||||
{
|
||||
app.FatalLoadError();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
DLCFile *dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name);
|
||||
pbData = dlcFile->getData(dwBytes);
|
||||
if(pbData == NULL || dwBytes == 0)
|
||||
{
|
||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||
if( l == 0 )
|
||||
{
|
||||
app.FatalLoadError();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
D3DXIMAGE_INFO ImageInfo;
|
||||
ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO));
|
||||
hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[l]);
|
||||
|
||||
|
||||
if(hr!=ERROR_SUCCESS)
|
||||
{
|
||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||
if( l == 0 )
|
||||
{
|
||||
app.FatalLoadError();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if( l == 0 )
|
||||
{
|
||||
width=ImageInfo.Width;
|
||||
height=ImageInfo.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes)
|
||||
{
|
||||
int iCurrentByte=0;
|
||||
for( int l = 0 ; l < 10; l++ )
|
||||
{
|
||||
data[l] = NULL;
|
||||
}
|
||||
|
||||
D3DXIMAGE_INFO ImageInfo;
|
||||
ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO));
|
||||
HRESULT hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[0]);
|
||||
|
||||
if(hr==ERROR_SUCCESS)
|
||||
{
|
||||
width=ImageInfo.Width;
|
||||
height=ImageInfo.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
app.FatalLoadError();
|
||||
}
|
||||
}
|
||||
|
||||
BufferedImage::~BufferedImage()
|
||||
{
|
||||
for(int i = 0; i < 10; i++ )
|
||||
{
|
||||
delete[] data[i];
|
||||
}
|
||||
}
|
||||
|
||||
int BufferedImage::getWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
int BufferedImage::getHeight()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
void BufferedImage::getRGB(int startX, int startY, int w, int h, intArray out,int offset,int scansize, int level)
|
||||
{
|
||||
int ww = width >> level;
|
||||
for( int y = 0; y < h; y++ )
|
||||
{
|
||||
for( int x = 0; x < w; x++ )
|
||||
{
|
||||
out[ y * scansize + offset + x] = data[level][ startX + x + ww * ( startY + y ) ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int *BufferedImage::getData()
|
||||
{
|
||||
return data[0];
|
||||
}
|
||||
|
||||
int *BufferedImage::getData(int level)
|
||||
{
|
||||
return data[level];
|
||||
}
|
||||
|
||||
Graphics *BufferedImage::getGraphics()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Returns the transparency. Returns either OPAQUE, BITMASK, or TRANSLUCENT.
|
||||
//Specified by:
|
||||
//getTransparency in interface Transparency
|
||||
//Returns:
|
||||
//the transparency of this BufferedImage.
|
||||
int BufferedImage::getTransparency()
|
||||
{
|
||||
// TODO - 4J Implement?
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Returns a subimage defined by a specified rectangular region. The returned BufferedImage shares the same data array as the original image.
|
||||
//Parameters:
|
||||
//x, y - the coordinates of the upper-left corner of the specified rectangular region
|
||||
//w - the width of the specified rectangular region
|
||||
//h - the height of the specified rectangular region
|
||||
//Returns:
|
||||
//a BufferedImage that is the subimage of this BufferedImage.
|
||||
BufferedImage *BufferedImage::getSubimage(int x ,int y, int w, int h)
|
||||
{
|
||||
// TODO - 4J Implement
|
||||
|
||||
BufferedImage *img = new BufferedImage(w,h,0);
|
||||
intArray arrayWrapper(img->data[0], w*h);
|
||||
this->getRGB(x, y, w, h, arrayWrapper,0,w);
|
||||
|
||||
int level = 1;
|
||||
while(getData(level) != NULL)
|
||||
{
|
||||
int ww = w >> level;
|
||||
int hh = h >> level;
|
||||
int xx = x >> level;
|
||||
int yy = y >> level;
|
||||
img->data[level] = new int[ww*hh];
|
||||
intArray arrayWrapper(img->data[level], ww*hh);
|
||||
this->getRGB(xx, yy, ww, hh, arrayWrapper,0,ww,level);
|
||||
|
||||
++level;
|
||||
}
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
|
||||
void BufferedImage::preMultiplyAlpha()
|
||||
{
|
||||
int *curData = data[0];
|
||||
|
||||
int cur = 0;
|
||||
int alpha = 0;
|
||||
int r = 0;
|
||||
int g = 0;
|
||||
int b = 0;
|
||||
|
||||
int total = width * height;
|
||||
for(unsigned int i = 0; i < total; ++i)
|
||||
{
|
||||
cur = curData[i];
|
||||
alpha = (cur >> 24) & 0xff;
|
||||
r = ((cur >> 16) & 0xff) * (float)alpha/255;
|
||||
g = ((cur >> 8) & 0xff) * (float)alpha/255;
|
||||
b = (cur & 0xff) * (float)alpha/255;
|
||||
|
||||
curData[i] = (r << 16) | (g << 8) | (b ) | (alpha << 24);
|
||||
}
|
||||
}
|
||||
33
Minecraft.Client/BufferedImage.h
Normal file
33
Minecraft.Client/BufferedImage.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
class Graphics;
|
||||
class DLCPack;
|
||||
|
||||
class BufferedImage
|
||||
{
|
||||
private:
|
||||
int *data[10]; // Arrays for mipmaps - NULL if not used
|
||||
int width;
|
||||
int height;
|
||||
void ByteFlip4(unsigned int &data); // 4J added
|
||||
public:
|
||||
static const int TYPE_INT_ARGB = 0;
|
||||
static const int TYPE_INT_RGB = 1;
|
||||
BufferedImage(int width,int height,int type);
|
||||
BufferedImage(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); // 4J added
|
||||
BufferedImage(DLCPack *dlcPack, const wstring& File, bool filenameHasExtension = false ); // 4J Added
|
||||
BufferedImage(BYTE *pbData, DWORD dwBytes); // 4J added
|
||||
~BufferedImage();
|
||||
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
void getRGB(int startX, int startY, int w, int h, intArray out,int offset,int scansize, int level = 0); // 4J Added level param
|
||||
int *getData(); // 4J added
|
||||
int *getData(int level); // 4J added
|
||||
Graphics *getGraphics();
|
||||
int getTransparency();
|
||||
BufferedImage *getSubimage(int x, int y, int w, int h);
|
||||
|
||||
void preMultiplyAlpha();
|
||||
};
|
||||
85
Minecraft.Client/Button.cpp
Normal file
85
Minecraft.Client/Button.cpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#include "stdafx.h"
|
||||
#include "Button.h"
|
||||
#include "Textures.h"
|
||||
|
||||
Button::Button(int id, int x, int y, const wstring& msg)
|
||||
{
|
||||
init(id, x, y, 200, 20, msg);
|
||||
}
|
||||
|
||||
Button::Button(int id, int x, int y, int w, int h, const wstring& msg)
|
||||
{
|
||||
init(id, x, y, w, h, msg);
|
||||
}
|
||||
|
||||
// 4J - added
|
||||
void Button::init(int id, int x, int y, int w, int h, const wstring& msg)
|
||||
{
|
||||
active = true;
|
||||
visible = true;
|
||||
|
||||
// this bit of code from original ctor
|
||||
this->id = id;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->w = w;
|
||||
this->h = h;
|
||||
this->msg = msg;
|
||||
}
|
||||
|
||||
int Button::getYImage(bool hovered)
|
||||
{
|
||||
int res = 1;
|
||||
if (!active) res = 0;
|
||||
else if (hovered) res = 2;
|
||||
return res;
|
||||
}
|
||||
|
||||
void Button::render(Minecraft *minecraft, int xm, int ym)
|
||||
{
|
||||
if (!visible) return;
|
||||
|
||||
Font *font = minecraft->font;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, minecraft->textures->loadTexture(TN_GUI_GUI)); // 4J was L"/gui/gui.png"
|
||||
glColor4f(1, 1, 1, 1);
|
||||
|
||||
|
||||
bool hovered = xm >= x && ym >= y && xm < x + w && ym < y + h;
|
||||
int yImage = getYImage(hovered);
|
||||
|
||||
blit(x, y, 0, 46 + yImage * 20, w / 2, h);
|
||||
blit(x + w / 2, y, 200 - w / 2, 46 + yImage * 20, w / 2, h);
|
||||
|
||||
renderBg(minecraft, xm, ym);
|
||||
|
||||
if (!active)
|
||||
{
|
||||
drawCenteredString(font, msg, x + w / 2, y + (h - 8) / 2, 0xffa0a0a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hovered)
|
||||
{
|
||||
drawCenteredString(font, msg, x + w / 2, y + (h - 8) / 2, 0xffffa0);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawCenteredString(font, msg, x + w / 2, y + (h - 8) / 2, 0xe0e0e0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Button::renderBg(Minecraft *minecraft, int xm, int ym)
|
||||
{
|
||||
}
|
||||
|
||||
void Button::released(int mx, int my)
|
||||
{
|
||||
}
|
||||
|
||||
bool Button::clicked(Minecraft *minecraft, int mx, int my)
|
||||
{
|
||||
return active && mx >= x && my >= y && mx < x + w && my < y + h;
|
||||
}
|
||||
30
Minecraft.Client/Button.h
Normal file
30
Minecraft.Client/Button.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
#include "GuiComponent.h"
|
||||
using namespace std;
|
||||
|
||||
class Button : public GuiComponent
|
||||
{
|
||||
protected:
|
||||
int w;
|
||||
int h;
|
||||
public:
|
||||
int x, y;
|
||||
wstring msg;
|
||||
int id;
|
||||
bool active;
|
||||
bool visible;
|
||||
|
||||
Button(int id, int x, int y, const wstring& msg);
|
||||
Button(int id, int x, int y, int w, int h, const wstring& msg);
|
||||
void init(int id, int x, int y, int w, int h, const wstring& msg); // 4J - added
|
||||
protected:
|
||||
virtual int getYImage(bool hovered);
|
||||
public:
|
||||
virtual void render(Minecraft *minecraft, int xm, int ym);
|
||||
|
||||
protected:
|
||||
virtual void renderBg(Minecraft *minecraft, int xm, int ym);
|
||||
public:
|
||||
virtual void released(int mx, int my);
|
||||
virtual bool clicked(Minecraft *minecraft, int mx, int my);
|
||||
};
|
||||
124
Minecraft.Client/Camera.cpp
Normal file
124
Minecraft.Client/Camera.cpp
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
#include "stdafx.h"
|
||||
#include "Camera.h"
|
||||
#include "MemoryTracker.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.entity.player.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
|
||||
#include "..\Minecraft.World\TilePos.h"
|
||||
|
||||
float Camera::xPlayerOffs = 0.0f;
|
||||
float Camera::yPlayerOffs = 0.0f;
|
||||
float Camera::zPlayerOffs = 0.0f;
|
||||
|
||||
//IntBuffer *Camera::viewport = MemoryTracker::createIntBuffer(16);
|
||||
FloatBuffer *Camera::modelview = MemoryTracker::createFloatBuffer(16);
|
||||
FloatBuffer *Camera::projection = MemoryTracker::createFloatBuffer(16);
|
||||
//FloatBuffer *Camera::position = MemoryTracker::createFloatBuffer(3);
|
||||
|
||||
float Camera::xa = 0.0f;
|
||||
float Camera::ya = 0.0f;
|
||||
float Camera::za = 0.0f;
|
||||
float Camera::xa2 = 0.0f;
|
||||
float Camera::za2 = 0.0f;
|
||||
|
||||
void Camera::prepare(shared_ptr<Player> player, bool mirror)
|
||||
{
|
||||
glGetFloat(GL_MODELVIEW_MATRIX, modelview);
|
||||
glGetFloat(GL_PROJECTION_MATRIX, projection);
|
||||
|
||||
/* Original java code for reference
|
||||
glGetInteger(GL_VIEWPORT, viewport);
|
||||
|
||||
float x = (viewport.get(0) + viewport.get(2)) / 2;
|
||||
float y = (viewport.get(1) + viewport.get(3)) / 2;
|
||||
gluUnProject(x, y, 0, modelview, projection, viewport, position);
|
||||
|
||||
xPlayerOffs = position->get(0);
|
||||
yPlayerOffs = position->get(1);
|
||||
zPlayerOffs = position->get(2);
|
||||
*/
|
||||
|
||||
// Xbox conversion here... note that we don't bother getting the viewport as this is just working out how to get a (0,0,0) point in clip space to pass into the inverted
|
||||
// combined model/view/projection matrix, so we just need to get this matrix and get its translation as an equivalent.
|
||||
XMMATRIX _modelview, _proj, _final, _invert;
|
||||
XMVECTOR _det;
|
||||
XMFLOAT4 trans;
|
||||
|
||||
memcpy( &_modelview, modelview->_getDataPointer(), 64 );
|
||||
memcpy( &_proj, projection->_getDataPointer(), 64 );
|
||||
|
||||
#if ( defined __ORBIS__ ) || ( defined __PSVITA__ )
|
||||
_modelview = transpose(_modelview);
|
||||
_proj = transpose(_proj);
|
||||
_final = _modelview * _proj;
|
||||
_invert = sce::Vectormath::Simd::Aos::inverse(_final);
|
||||
xPlayerOffs = _invert.getElem(0,3) / _invert.getElem(3,3);
|
||||
yPlayerOffs = _invert.getElem(1,3) / _invert.getElem(3,3);
|
||||
zPlayerOffs = _invert.getElem(2,3) / _invert.getElem(3,3);
|
||||
#elif defined __PS3__
|
||||
_modelview = transpose(_modelview);
|
||||
_proj = transpose(_proj);
|
||||
_final = _modelview * _proj;
|
||||
_invert = Vectormath::Aos::inverse(_final);
|
||||
xPlayerOffs = _invert.getElem(0,3) / _invert.getElem(3,3);
|
||||
yPlayerOffs = _invert.getElem(1,3) / _invert.getElem(3,3);
|
||||
zPlayerOffs = _invert.getElem(2,3) / _invert.getElem(3,3);
|
||||
#else
|
||||
_final = XMMatrixMultiply( _modelview, _proj );
|
||||
_det = XMMatrixDeterminant(_final);
|
||||
_invert = XMMatrixInverse(&_det, _final);
|
||||
|
||||
XMStoreFloat4(&trans,_invert.r[3]);
|
||||
|
||||
xPlayerOffs = trans.x / trans.w;
|
||||
yPlayerOffs = trans.y / trans.w;
|
||||
zPlayerOffs = trans.z / trans.w;
|
||||
#endif
|
||||
|
||||
int flipCamera = mirror ? 1 : 0;
|
||||
|
||||
float xRot = player->xRot;
|
||||
float yRot = player->yRot;
|
||||
|
||||
xa = cosf(yRot * PI / 180.0f) * (1 - flipCamera * 2);
|
||||
za = sinf(yRot * PI / 180.0f) * (1 - flipCamera * 2);
|
||||
|
||||
xa2 = -za * sinf(xRot * PI / 180.0f) * (1 - flipCamera * 2);
|
||||
za2 = xa * sinf(xRot * PI / 180.0f) * (1 - flipCamera * 2);
|
||||
ya = cosf(xRot * PI / 180.0f);
|
||||
}
|
||||
|
||||
TilePos *Camera::getCameraTilePos(shared_ptr<Mob> player, double alpha)
|
||||
{
|
||||
return new TilePos(getCameraPos(player, alpha));
|
||||
}
|
||||
|
||||
Vec3 *Camera::getCameraPos(shared_ptr<Mob> player, double alpha)
|
||||
{
|
||||
double xx = player->xo + (player->x - player->xo) * alpha;
|
||||
double yy = player->yo + (player->y - player->yo) * alpha + player->getHeadHeight();
|
||||
double zz = player->zo + (player->z - player->zo) * alpha;
|
||||
|
||||
double xt = xx + Camera::xPlayerOffs * 1;
|
||||
double yt = yy + Camera::yPlayerOffs * 1;
|
||||
double zt = zz + Camera::zPlayerOffs * 1;
|
||||
|
||||
return Vec3::newTemp(xt, yt, zt);
|
||||
}
|
||||
|
||||
int Camera::getBlockAt(Level *level, shared_ptr<Mob> player, float alpha)
|
||||
{
|
||||
Vec3 *p = Camera::getCameraPos(player, alpha);
|
||||
TilePos tp = TilePos(p);
|
||||
int t = level->getTile(tp.x, tp.y, tp.z);
|
||||
if (t != 0 && Tile::tiles[t]->material->isLiquid())
|
||||
{
|
||||
float hh = LiquidTile::getHeight(level->getData(tp.x, tp.y, tp.z)) - 1 / 9.0f;
|
||||
float h = tp.y + 1 - hh;
|
||||
if (p->y >= h)
|
||||
{
|
||||
t = level->getTile(tp.x, tp.y + 1, tp.z);
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
32
Minecraft.Client/Camera.h
Normal file
32
Minecraft.Client/Camera.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
#include "..\Minecraft.World\FloatBuffer.h"
|
||||
#include "..\Minecraft.World\IntBuffer.h"
|
||||
|
||||
|
||||
class TilePos;
|
||||
class Vec3;
|
||||
class Player;
|
||||
class Mob;
|
||||
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
static float xPlayerOffs;
|
||||
static float yPlayerOffs;
|
||||
static float zPlayerOffs;
|
||||
|
||||
private:
|
||||
// static IntBuffer *viewport;
|
||||
static FloatBuffer *modelview;
|
||||
static FloatBuffer *projection;
|
||||
// static FloatBuffer *position;
|
||||
|
||||
public:
|
||||
static float xa, ya, za, xa2, za2;
|
||||
|
||||
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);
|
||||
};
|
||||
89
Minecraft.Client/ChatScreen.cpp
Normal file
89
Minecraft.Client/ChatScreen.cpp
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#include "stdafx.h"
|
||||
#include "ChatScreen.h"
|
||||
#include "MultiplayerLocalPlayer.h"
|
||||
#include "..\Minecraft.World\SharedConstants.h"
|
||||
#include "..\Minecraft.World\StringHelpers.h"
|
||||
|
||||
const wstring ChatScreen::allowedChars = SharedConstants::acceptableLetters;
|
||||
|
||||
ChatScreen::ChatScreen()
|
||||
{
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
void ChatScreen::init()
|
||||
{
|
||||
Keyboard::enableRepeatEvents(true);
|
||||
}
|
||||
|
||||
void ChatScreen::removed()
|
||||
{
|
||||
Keyboard::enableRepeatEvents(false);
|
||||
}
|
||||
|
||||
void ChatScreen::tick()
|
||||
{
|
||||
frame++;
|
||||
}
|
||||
|
||||
void ChatScreen::keyPressed(wchar_t ch, int eventKey)
|
||||
{
|
||||
if (eventKey == Keyboard::KEY_ESCAPE)
|
||||
{
|
||||
minecraft->setScreen(NULL);
|
||||
return;
|
||||
}
|
||||
if (eventKey == Keyboard::KEY_RETURN)
|
||||
{
|
||||
wstring msg = trimString(message);
|
||||
if (msg.length() > 0)
|
||||
{
|
||||
wstring trim = trimString(message);
|
||||
if (!minecraft->handleClientSideCommand(trim))
|
||||
{
|
||||
minecraft->player->chat(trim);
|
||||
}
|
||||
}
|
||||
minecraft->setScreen(NULL);
|
||||
return;
|
||||
}
|
||||
if (eventKey == Keyboard::KEY_BACK && message.length() > 0) message = message.substr(0, message.length() - 1);
|
||||
if (allowedChars.find(ch) >= 0 && message.length() < SharedConstants::maxChatLength)
|
||||
{
|
||||
message += ch;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ChatScreen::render(int xm, int ym, float a)
|
||||
{
|
||||
fill(2, height - 14, width - 2, height - 2, 0x80000000);
|
||||
drawString(font, L"> " + message + (frame / 6 % 2 == 0 ? L"_" : L""), 4, height - 12, 0xe0e0e0);
|
||||
|
||||
Screen::render(xm, ym, a);
|
||||
}
|
||||
|
||||
void ChatScreen::mouseClicked(int x, int y, int buttonNum)
|
||||
{
|
||||
if (buttonNum == 0)
|
||||
{
|
||||
if (minecraft->gui->selectedName != L"") // 4J - was NULL comparison
|
||||
{
|
||||
if (message.length() > 0 && message[message.length()-1]!=L' ')
|
||||
{
|
||||
message += L" ";
|
||||
}
|
||||
message += minecraft->gui->selectedName;
|
||||
unsigned int maxLength = SharedConstants::maxChatLength;
|
||||
if (message.length() > maxLength)
|
||||
{
|
||||
message = message.substr(0, maxLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen::mouseClicked(x, y, buttonNum);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
25
Minecraft.Client/ChatScreen.h
Normal file
25
Minecraft.Client/ChatScreen.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
#include "Screen.h"
|
||||
using namespace std;
|
||||
|
||||
class ChatScreen : public Screen
|
||||
{
|
||||
protected:
|
||||
wstring message;
|
||||
private:
|
||||
int frame;
|
||||
|
||||
public:
|
||||
ChatScreen(); //4J added
|
||||
virtual void init();
|
||||
virtual void removed();
|
||||
virtual void tick();
|
||||
private:
|
||||
static const wstring allowedChars;
|
||||
protected:
|
||||
void keyPressed(wchar_t ch, int eventKey);
|
||||
public:
|
||||
void render(int xm, int ym, float a);
|
||||
protected:
|
||||
void mouseClicked(int x, int y, int buttonNum);
|
||||
};
|
||||
43
Minecraft.Client/ChestModel.cpp
Normal file
43
Minecraft.Client/ChestModel.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include "stdafx.h"
|
||||
#include "ChestModel.h"
|
||||
#include "ModelPart.h"
|
||||
|
||||
ChestModel::ChestModel()
|
||||
{
|
||||
lid = ((new ModelPart(this, 0, 0)))->setTexSize(64, 64);
|
||||
lid->addBox(0.0f, -5.0f, -14.0f, 14, 5, 14, 0.0f);
|
||||
lid->x = 1;
|
||||
lid->y = 7;
|
||||
lid->z = 15;
|
||||
|
||||
lock = ((new ModelPart(this, 0, 0)))->setTexSize(64, 64);
|
||||
lock->addBox(-1.0f, -2.0f, -15.0f, 2, 4, 1, 0.0f);
|
||||
lock->x = 8;
|
||||
lock->y = 7;
|
||||
lock->z = 15;
|
||||
|
||||
bottom = ((new ModelPart(this, 0, 19)))->setTexSize(64, 64);
|
||||
bottom->addBox(0.0f, 0.0f, 0.0f, 14, 10, 14, 0.0f);
|
||||
bottom->x = 1;
|
||||
bottom->y = 6;
|
||||
bottom->z = 1;
|
||||
|
||||
|
||||
// 4J added - compile now to avoid random performance hit first time cubes are rendered
|
||||
lid->compile(1.0f/16.0f);
|
||||
lock->compile(1.0f/16.0f);
|
||||
bottom->compile(1.0f/16.0f);
|
||||
}
|
||||
|
||||
void ChestModel::render(bool usecompiled)
|
||||
{
|
||||
lock->xRot = lid->xRot;
|
||||
|
||||
lock->render(1 / 16.0f, usecompiled);
|
||||
bottom->render(1 / 16.0f, usecompiled);
|
||||
|
||||
// 4J - moved lid to last and added z-bias to avoid glitching caused by z-fighting between the area of overlap between the lid & bottom of the chest
|
||||
glPolygonOffset(-0.3f, -0.3f);
|
||||
lid->render(1 / 16.0f, usecompiled);
|
||||
glPolygonOffset(0.0f, 0.0f);
|
||||
}
|
||||
18
Minecraft.Client/ChestModel.h
Normal file
18
Minecraft.Client/ChestModel.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include "Model.h"
|
||||
|
||||
class Cube;
|
||||
|
||||
class ChestModel : public Model
|
||||
{
|
||||
public:
|
||||
using Model::render;
|
||||
|
||||
ModelPart *lid;
|
||||
ModelPart *bottom;
|
||||
ModelPart *lock;
|
||||
|
||||
ChestModel();
|
||||
void render(bool usecompiled);
|
||||
};
|
||||
105
Minecraft.Client/ChestRenderer.cpp
Normal file
105
Minecraft.Client/ChestRenderer.cpp
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
#include "stdafx.h"
|
||||
#include "ChestRenderer.h"
|
||||
#include "ChestModel.h"
|
||||
#include "LargeChestModel.h"
|
||||
#include "ModelPart.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.tile.h"
|
||||
|
||||
ChestRenderer::ChestRenderer()
|
||||
{
|
||||
chestModel = new ChestModel();
|
||||
largeChestModel = new LargeChestModel();
|
||||
}
|
||||
|
||||
ChestRenderer::~ChestRenderer()
|
||||
{
|
||||
delete chestModel;
|
||||
delete largeChestModel;
|
||||
}
|
||||
|
||||
void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled)
|
||||
{
|
||||
// 4J Convert as we aren't using a templated class
|
||||
shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(_chest);
|
||||
|
||||
int data;
|
||||
|
||||
if (!chest->hasLevel())
|
||||
{
|
||||
data = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Tile *tile = chest->getTile();
|
||||
data = chest->getData();
|
||||
|
||||
if (tile != NULL && data == 0)
|
||||
{
|
||||
((ChestTile *) tile)->recalcLockDir(chest->getLevel(), chest->x, chest->y, chest->z);
|
||||
data = chest->getData();
|
||||
}
|
||||
|
||||
chest->checkNeighbors();
|
||||
}
|
||||
if (chest->n.lock() != NULL || chest->w.lock() != NULL) return;
|
||||
|
||||
|
||||
ChestModel *model;
|
||||
if (chest->e.lock() != NULL || chest->s.lock() != NULL)
|
||||
{
|
||||
model = largeChestModel;
|
||||
bindTexture(TN_TILE_LARGE_CHEST); // 4J Was "/item/largechest.png"
|
||||
}
|
||||
else
|
||||
{
|
||||
model = chestModel;
|
||||
bindTexture(TN_TILE_CHEST); // 4J Was "/item/chest.png"
|
||||
}
|
||||
|
||||
glPushMatrix();
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
//if( setColor ) glColor4f(1, 1, 1, 1);
|
||||
if( setColor ) glColor4f(1, 1, 1, alpha);
|
||||
glTranslatef((float) x, (float) y + 1, (float) z + 1);
|
||||
glScalef(1, -1, -1);
|
||||
|
||||
glTranslatef(0.5f, 0.5f, 0.5f);
|
||||
int rot = 0;
|
||||
if (data == 2) rot = 180;
|
||||
if (data == 3) rot = 0;
|
||||
if (data == 4) rot = 90;
|
||||
if (data == 5) rot = -90;
|
||||
|
||||
if (data == 2 && chest->e.lock() != NULL)
|
||||
{
|
||||
glTranslatef(1, 0, 0);
|
||||
}
|
||||
if (data == 5 && chest->s.lock() != NULL)
|
||||
{
|
||||
glTranslatef(0, 0, -1);
|
||||
}
|
||||
glRotatef(rot, 0, 1, 0);
|
||||
glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
|
||||
float open = chest->oOpenness + (chest->openness - chest->oOpenness) * a;
|
||||
if (chest->n.lock() != NULL)
|
||||
{
|
||||
float open2 = chest->n.lock()->oOpenness + (chest->n.lock()->openness - chest->n.lock()->oOpenness) * a;
|
||||
if (open2 > open) open = open2;
|
||||
}
|
||||
if (chest->w.lock() != NULL)
|
||||
{
|
||||
float open2 = chest->w.lock()->oOpenness + (chest->w.lock()->openness - chest->w.lock()->oOpenness) * a;
|
||||
if (open2 > open) open = open2;
|
||||
}
|
||||
|
||||
open = 1 - open;
|
||||
open = 1 - open * open * open;
|
||||
|
||||
model->lid->xRot = -(open * PI / 2);
|
||||
model->render(useCompiled);
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
glPopMatrix();
|
||||
if( setColor ) glColor4f(1, 1, 1, 1);
|
||||
}
|
||||
18
Minecraft.Client/ChestRenderer.h
Normal file
18
Minecraft.Client/ChestRenderer.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include "TileEntityRenderer.h"
|
||||
|
||||
class ChestModel;
|
||||
|
||||
class ChestRenderer : public TileEntityRenderer
|
||||
{
|
||||
private:
|
||||
ChestModel *chestModel;
|
||||
ChestModel *largeChestModel;
|
||||
|
||||
public:
|
||||
ChestRenderer();
|
||||
~ChestRenderer();
|
||||
|
||||
void render(shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param
|
||||
};
|
||||
104
Minecraft.Client/ChickenModel.cpp
Normal file
104
Minecraft.Client/ChickenModel.cpp
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\Minecraft.World\Mth.h"
|
||||
#include "ChickenModel.h"
|
||||
#include "ModelPart.h"
|
||||
|
||||
ChickenModel::ChickenModel() : Model()
|
||||
{
|
||||
int yo = 16;
|
||||
head = new ModelPart(this, 0, 0);
|
||||
head->addBox(-2.0f, -6.0f, -2.0f, 4, 6, 3, 0.0f); // Head
|
||||
head->setPos(0, (float)(-1 + yo), -4);
|
||||
|
||||
beak = new ModelPart(this, 14, 0);
|
||||
beak->addBox(-2.0f, -4.0f, -4.0f, 4, 2, 2, 0.0f); // Beak
|
||||
beak->setPos(0, (float)(-1 + yo), -4);
|
||||
|
||||
redThing = new ModelPart(this, 14, 4);
|
||||
redThing->addBox(-1.0f, -2.0f, -3.0f, 2, 2, 2, 0.0f); // Beak
|
||||
redThing->setPos(0, (float)(-1 + yo), -4);
|
||||
|
||||
body = new ModelPart(this, 0, 9);
|
||||
body->addBox(-3.0f, -4.0f, -3.0f, 6, 8, 6, 0.0f); // Body
|
||||
body->setPos(0, (float)(0 + yo), 0);
|
||||
|
||||
leg0 = new ModelPart(this, 26, 0);
|
||||
leg0->addBox(-1.0f, 0.0f, -3.0f, 3, 5, 3); // Leg0
|
||||
leg0->setPos(-2, (float)(3 + yo), 1);
|
||||
|
||||
leg1 = new ModelPart(this, 26, 0);
|
||||
leg1->addBox(-1.0f, 0.0f, -3.0f, 3, 5, 3); // Leg1
|
||||
leg1->setPos(1, (float)(3 + yo), 1);
|
||||
|
||||
wing0 = new ModelPart(this, 24, 13);
|
||||
wing0->addBox(0.0f, 0.0f, -3.0f, 1, 4, 6); // Wing0
|
||||
wing0->setPos(-4, (float)(-3 + yo), 0);
|
||||
|
||||
wing1 = new ModelPart(this, 24, 13);
|
||||
wing1->addBox(-1.0f, 0.0f, -3.0f, 1, 4, 6); // Wing1
|
||||
wing1->setPos(4, (float)(-3 + yo), 0);
|
||||
|
||||
// 4J added - compile now to avoid random performance hit first time cubes are rendered
|
||||
head->compile(1.0f/16.0f);
|
||||
beak->compile(1.0f/16.0f);
|
||||
redThing->compile(1.0f/16.0f);
|
||||
body->compile(1.0f/16.0f);
|
||||
leg0->compile(1.0f/16.0f);
|
||||
leg1->compile(1.0f/16.0f);
|
||||
wing0->compile(1.0f/16.0f);
|
||||
wing1->compile(1.0f/16.0f);
|
||||
}
|
||||
|
||||
void ChickenModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||
{
|
||||
setupAnim(time, r, bob, yRot, xRot, scale);
|
||||
if (young)
|
||||
{
|
||||
float ss = 2;
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 5 * scale, 2 * scale);
|
||||
head->render(scale,usecompiled);
|
||||
beak->render(scale,usecompiled);
|
||||
redThing->render(scale,usecompiled);
|
||||
glPopMatrix();
|
||||
glPushMatrix();
|
||||
glScalef(1 / ss, 1 / ss, 1 / ss);
|
||||
glTranslatef(0, 24 * scale, 0);
|
||||
body->render(scale,usecompiled);
|
||||
leg0->render(scale,usecompiled);
|
||||
leg1->render(scale,usecompiled);
|
||||
wing0->render(scale,usecompiled);
|
||||
wing1->render(scale,usecompiled);
|
||||
glPopMatrix();
|
||||
}
|
||||
else
|
||||
{
|
||||
head->render(scale,usecompiled);
|
||||
beak->render(scale,usecompiled);
|
||||
redThing->render(scale,usecompiled);
|
||||
body->render(scale,usecompiled);
|
||||
leg0->render(scale,usecompiled);
|
||||
leg1->render(scale,usecompiled);
|
||||
wing0->render(scale,usecompiled);
|
||||
wing1->render(scale,usecompiled);
|
||||
}
|
||||
}
|
||||
|
||||
void ChickenModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim)
|
||||
{
|
||||
head->xRot = xRot / (float) (180 / PI);
|
||||
head->yRot = yRot / (float) (180 / PI);
|
||||
|
||||
beak->xRot = head->xRot;
|
||||
beak->yRot = head->yRot;
|
||||
|
||||
redThing->xRot = head->xRot;
|
||||
redThing->yRot = head->yRot;
|
||||
|
||||
body->xRot = 90 / (float) (180 / PI);
|
||||
|
||||
leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
|
||||
leg1->xRot = ( Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
|
||||
wing0->zRot = bob;
|
||||
wing1->zRot = -bob;
|
||||
}
|
||||
11
Minecraft.Client/ChickenModel.h
Normal file
11
Minecraft.Client/ChickenModel.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include "Model.h"
|
||||
|
||||
class ChickenModel : public Model
|
||||
{
|
||||
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);
|
||||
};
|
||||
24
Minecraft.Client/ChickenRenderer.cpp
Normal file
24
Minecraft.Client/ChickenRenderer.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\Minecraft.World\Mth.h"
|
||||
#include "ChickenRenderer.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.entity.animal.h"
|
||||
|
||||
ChickenRenderer::ChickenRenderer(Model *model, float shadow) : MobRenderer(model,shadow)
|
||||
{
|
||||
}
|
||||
|
||||
void ChickenRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||
{
|
||||
MobRenderer::render(_mob, x, y, z, rot, a);
|
||||
}
|
||||
|
||||
float ChickenRenderer::getBob(shared_ptr<Mob> _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);
|
||||
|
||||
float flap = mob->oFlap+(mob->flap-mob->oFlap)*a;
|
||||
float flapSpeed = mob->oFlapSpeed+(mob->flapSpeed-mob->oFlapSpeed)*a;
|
||||
|
||||
return (Mth::sin(flap)+1)*flapSpeed;
|
||||
}
|
||||
11
Minecraft.Client/ChickenRenderer.h
Normal file
11
Minecraft.Client/ChickenRenderer.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include "MobRenderer.h"
|
||||
|
||||
class ChickenRenderer : public MobRenderer
|
||||
{
|
||||
public:
|
||||
ChickenRenderer(Model *model, float shadow);
|
||||
virtual void render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a);
|
||||
protected:
|
||||
virtual float getBob(shared_ptr<Mob> _mob, float a);
|
||||
};
|
||||
1045
Minecraft.Client/Chunk.cpp
Normal file
1045
Minecraft.Client/Chunk.cpp
Normal file
File diff suppressed because it is too large
Load diff
87
Minecraft.Client/Chunk.h
Normal file
87
Minecraft.Client/Chunk.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
#pragma once
|
||||
#include "AllowAllCuller.h"
|
||||
#include "Tesselator.h"
|
||||
#include "..\Minecraft.World\ArrayWithLength.h"
|
||||
#include "LevelRenderer.h"
|
||||
|
||||
class Level;
|
||||
class TileEntity;
|
||||
class Entity;
|
||||
using namespace std;
|
||||
|
||||
class ClipChunk
|
||||
{
|
||||
public:
|
||||
Chunk *chunk;
|
||||
int globalIdx;
|
||||
bool visible;
|
||||
float aabb[6];
|
||||
int xm, ym, zm;
|
||||
};
|
||||
|
||||
class Chunk
|
||||
{
|
||||
private:
|
||||
static const int XZSIZE = LevelRenderer::CHUNK_XZSIZE;
|
||||
static const int SIZE = LevelRenderer::CHUNK_SIZE;
|
||||
|
||||
public:
|
||||
Level *level;
|
||||
static LevelRenderer *levelRenderer;
|
||||
private:
|
||||
#ifndef _LARGE_WORLDS
|
||||
static Tesselator *t;
|
||||
#else
|
||||
static DWORD tlsIdx;
|
||||
public:
|
||||
static void CreateNewThreadStorage();
|
||||
static void ReleaseThreadStorage();
|
||||
static unsigned char *GetTileIdsStorage();
|
||||
#endif
|
||||
|
||||
public:
|
||||
static int updates;
|
||||
|
||||
int x, y, z;
|
||||
int xRender, yRender, zRender;
|
||||
int xRenderOffs, yRenderOffs, zRenderOffs;
|
||||
|
||||
int xm, ym, zm;
|
||||
AABB *bb;
|
||||
ClipChunk *clipChunk;
|
||||
|
||||
int id;
|
||||
//public:
|
||||
// vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - removed
|
||||
|
||||
private:
|
||||
LevelRenderer::rteMap *globalRenderableTileEntities;
|
||||
CRITICAL_SECTION *globalRenderableTileEntities_cs;
|
||||
bool assigned;
|
||||
public:
|
||||
Chunk(Level *level, LevelRenderer::rteMap &globalRenderableTileEntities, CRITICAL_SECTION &globalRenderableTileEntities_cs, int x, int y, int z, ClipChunk *clipChunk);
|
||||
Chunk();
|
||||
|
||||
void setPos(int x, int y, int z);
|
||||
private:
|
||||
void translateToPos();
|
||||
public:
|
||||
void makeCopyForRebuild(Chunk *source);
|
||||
void rebuild();
|
||||
#ifdef __PS3__
|
||||
void rebuild_SPU();
|
||||
#endif // __PS3__
|
||||
float distanceToSqr(shared_ptr<Entity> player) const;
|
||||
float squishedDistanceToSqr(shared_ptr<Entity> player);
|
||||
void reset();
|
||||
void _delete();
|
||||
|
||||
int getList(int layer);
|
||||
void cull(Culler *culler);
|
||||
void renderBB() ;
|
||||
bool isEmpty();
|
||||
void setDirty();
|
||||
void clearDirty(); // 4J added
|
||||
bool emptyFlagSet(int layer);
|
||||
~Chunk();
|
||||
};
|
||||
3347
Minecraft.Client/ClientConnection.cpp
Normal file
3347
Minecraft.Client/ClientConnection.cpp
Normal file
File diff suppressed because it is too large
Load diff
140
Minecraft.Client/ClientConnection.h
Normal file
140
Minecraft.Client/ClientConnection.h
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
#pragma once
|
||||
#include "..\Minecraft.World\net.minecraft.network.h"
|
||||
class Minecraft;
|
||||
class MultiPlayerLevel;
|
||||
class SavedDataStorage;
|
||||
class Socket;
|
||||
class MultiplayerLocalPlayer;
|
||||
|
||||
class ClientConnection : public PacketListener
|
||||
{
|
||||
private:
|
||||
enum eClientConnectionConnectingState
|
||||
{
|
||||
eCCPreLoginSent = 0,
|
||||
eCCPreLoginReceived,
|
||||
eCCLoginSent,
|
||||
eCCLoginReceived,
|
||||
eCCConnected
|
||||
};
|
||||
private:
|
||||
bool done;
|
||||
Connection *connection;
|
||||
public:
|
||||
wstring message;
|
||||
bool createdOk; // 4J added
|
||||
private:
|
||||
Minecraft *minecraft;
|
||||
MultiPlayerLevel *level;
|
||||
bool started;
|
||||
|
||||
// 4J Stu - I don't think we are interested in the PlayerInfo data, so I'm not going to use it at the moment
|
||||
//Map<String, PlayerInfo> playerInfoMap = new HashMap<String, PlayerInfo>();
|
||||
public:
|
||||
//List<PlayerInfo> playerInfos = new ArrayList<PlayerInfo>();
|
||||
|
||||
int maxPlayers;
|
||||
|
||||
public:
|
||||
bool isStarted() { return started; } // 4J Added
|
||||
bool isClosed() { return done; } // 4J Added
|
||||
Socket *getSocket() { return connection->getSocket(); } // 4J Added
|
||||
|
||||
private:
|
||||
DWORD m_userIndex; // 4J Added
|
||||
public:
|
||||
SavedDataStorage *savedDataStorage;
|
||||
ClientConnection(Minecraft *minecraft, const wstring& ip, int port);
|
||||
ClientConnection(Minecraft *minecraft, Socket *socket, int iUserIndex = -1);
|
||||
~ClientConnection();
|
||||
void tick();
|
||||
INetworkPlayer *getNetworkPlayer();
|
||||
virtual void handleLogin(shared_ptr<LoginPacket> packet);
|
||||
virtual void handleAddEntity(shared_ptr<AddEntityPacket> packet);
|
||||
virtual void handleAddExperienceOrb(shared_ptr<AddExperienceOrbPacket> packet);
|
||||
virtual void handleAddGlobalEntity(shared_ptr<AddGlobalEntityPacket> packet);
|
||||
virtual void handleAddPainting(shared_ptr<AddPaintingPacket> packet);
|
||||
virtual void handleSetEntityMotion(shared_ptr<SetEntityMotionPacket> packet);
|
||||
virtual void handleSetEntityData(shared_ptr<SetEntityDataPacket> packet);
|
||||
virtual void handleAddPlayer(shared_ptr<AddPlayerPacket> packet);
|
||||
virtual void handleTeleportEntity(shared_ptr<TeleportEntityPacket> packet);
|
||||
virtual void handleMoveEntity(shared_ptr<MoveEntityPacket> packet);
|
||||
virtual void handleRotateMob(shared_ptr<RotateHeadPacket> packet);
|
||||
virtual void handleMoveEntitySmall(shared_ptr<MoveEntityPacketSmall> packet);
|
||||
virtual void handleRemoveEntity(shared_ptr<RemoveEntitiesPacket> packet);
|
||||
virtual void handleMovePlayer(shared_ptr<MovePlayerPacket> packet);
|
||||
|
||||
Random *random;
|
||||
|
||||
// 4J Added
|
||||
virtual void handleChunkVisibilityArea(shared_ptr<ChunkVisibilityAreaPacket> packet);
|
||||
|
||||
virtual void handleChunkVisibility(shared_ptr<ChunkVisibilityPacket> packet);
|
||||
virtual void handleChunkTilesUpdate(shared_ptr<ChunkTilesUpdatePacket> packet);
|
||||
virtual void handleBlockRegionUpdate(shared_ptr<BlockRegionUpdatePacket> packet);
|
||||
virtual void handleTileUpdate(shared_ptr<TileUpdatePacket> packet);
|
||||
virtual void handleDisconnect(shared_ptr<DisconnectPacket> packet);
|
||||
virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects);
|
||||
void sendAndDisconnect(shared_ptr<Packet> packet);
|
||||
void send(shared_ptr<Packet> packet);
|
||||
virtual void handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> packet);
|
||||
virtual void handleChat(shared_ptr<ChatPacket> packet);
|
||||
virtual void handleAnimate(shared_ptr<AnimatePacket> packet);
|
||||
virtual void handleEntityActionAtPosition(shared_ptr<EntityActionAtPositionPacket> packet);
|
||||
virtual void handlePreLogin(shared_ptr<PreLoginPacket> packet);
|
||||
void close();
|
||||
virtual void handleAddMob(shared_ptr<AddMobPacket> packet);
|
||||
virtual void handleSetTime(shared_ptr<SetTimePacket> packet);
|
||||
virtual void handleSetSpawn(shared_ptr<SetSpawnPositionPacket> packet);
|
||||
virtual void handleRidePacket(shared_ptr<SetRidingPacket> packet);
|
||||
virtual void handleEntityEvent(shared_ptr<EntityEventPacket> packet);
|
||||
private:
|
||||
shared_ptr<Entity> getEntity(int entityId);
|
||||
wstring GetDisplayNameByGamertag(wstring gamertag);
|
||||
public:
|
||||
virtual void handleSetHealth(shared_ptr<SetHealthPacket> packet);
|
||||
virtual void handleSetExperience(shared_ptr<SetExperiencePacket> packet);
|
||||
virtual void handleRespawn(shared_ptr<RespawnPacket> packet);
|
||||
virtual void handleExplosion(shared_ptr<ExplodePacket> packet);
|
||||
virtual void handleContainerOpen(shared_ptr<ContainerOpenPacket> packet);
|
||||
virtual void handleContainerSetSlot(shared_ptr<ContainerSetSlotPacket> packet);
|
||||
virtual void handleContainerAck(shared_ptr<ContainerAckPacket> packet);
|
||||
virtual void handleContainerContent(shared_ptr<ContainerSetContentPacket> packet);
|
||||
virtual void handleSignUpdate(shared_ptr<SignUpdatePacket> packet);
|
||||
virtual void handleTileEntityData(shared_ptr<TileEntityDataPacket> packet);
|
||||
virtual void handleContainerSetData(shared_ptr<ContainerSetDataPacket> packet);
|
||||
virtual void handleSetEquippedItem(shared_ptr<SetEquippedItemPacket> packet);
|
||||
virtual void handleContainerClose(shared_ptr<ContainerClosePacket> packet);
|
||||
virtual void handleTileEvent(shared_ptr<TileEventPacket> packet);
|
||||
virtual void handleTileDestruction(shared_ptr<TileDestructionPacket> packet);
|
||||
virtual bool canHandleAsyncPackets();
|
||||
virtual void handleGameEvent(shared_ptr<GameEventPacket> gameEventPacket);
|
||||
virtual void handleComplexItemData(shared_ptr<ComplexItemDataPacket> packet);
|
||||
virtual void handleLevelEvent(shared_ptr<LevelEventPacket> packet);
|
||||
virtual void handleAwardStat(shared_ptr<AwardStatPacket> packet);
|
||||
virtual void handleUpdateMobEffect(shared_ptr<UpdateMobEffectPacket> packet);
|
||||
virtual void handleRemoveMobEffect(shared_ptr<RemoveMobEffectPacket> packet);
|
||||
virtual bool isServerPacketListener();
|
||||
virtual void handlePlayerInfo(shared_ptr<PlayerInfoPacket> packet);
|
||||
virtual void handleKeepAlive(shared_ptr<KeepAlivePacket> packet);
|
||||
virtual void handlePlayerAbilities(shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket);
|
||||
virtual void handleSoundEvent(shared_ptr<LevelSoundPacket> packet);
|
||||
virtual void handleCustomPayload(shared_ptr<CustomPayloadPacket> customPayloadPacket);
|
||||
virtual Connection *getConnection();
|
||||
|
||||
// 4J Added
|
||||
virtual void handleServerSettingsChanged(shared_ptr<ServerSettingsChangedPacket> packet);
|
||||
virtual void handleTexture(shared_ptr<TexturePacket> packet);
|
||||
virtual void handleTextureAndGeometry(shared_ptr<TextureAndGeometryPacket> packet);
|
||||
virtual void handleUpdateProgress(shared_ptr<UpdateProgressPacket> packet);
|
||||
|
||||
// 4J Added
|
||||
static int HostDisconnectReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
virtual void handleTextureChange(shared_ptr<TextureChangePacket> packet);
|
||||
virtual void handleTextureAndGeometryChange(shared_ptr<TextureAndGeometryChangePacket> packet);
|
||||
virtual void handleUpdateGameRuleProgressPacket(shared_ptr<UpdateGameRuleProgressPacket> packet);
|
||||
virtual void handleXZ(shared_ptr<XZPacket> packet);
|
||||
|
||||
void displayPrivilegeChanges(shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges);
|
||||
};
|
||||
5
Minecraft.Client/ClientConstants.cpp
Normal file
5
Minecraft.Client/ClientConstants.cpp
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#include "stdafx.h"
|
||||
#include "ClientConstants.h"
|
||||
|
||||
const wstring ClientConstants::VERSION_STRING = wstring(L"Minecraft Xbox ") + VER_FILEVERSION_STR_W;//+ SharedConstants::VERSION_STRING;
|
||||
bool ClientConstants::SHOW_LCEMP_WATERMARK = true;
|
||||
19
Minecraft.Client/ClientConstants.h
Normal file
19
Minecraft.Client/ClientConstants.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
class ClientConstants
|
||||
{
|
||||
|
||||
// This file holds global constants used by the client.
|
||||
// The file should be replaced at compile-time with the
|
||||
// proper settings for the given compilation. For example,
|
||||
// release builds should replace this file with no-cheat
|
||||
// settings.
|
||||
|
||||
// INTERNAL DEVELOPMENT SETTINGS
|
||||
public:
|
||||
static const wstring VERSION_STRING;
|
||||
|
||||
static const bool DEADMAU5_CAMERA_CHEATS = false;
|
||||
static bool SHOW_LCEMP_WATERMARK;
|
||||
};
|
||||
119
Minecraft.Client/ClockTexture.cpp
Normal file
119
Minecraft.Client/ClockTexture.cpp
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#include "stdafx.h"
|
||||
#include "Minecraft.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.h"
|
||||
#include "..\Minecraft.World\net.minecraft.world.level.dimension.h"
|
||||
#include "MultiplayerLocalPlayer.h"
|
||||
#include "..\Minecraft.World\JavaMath.h"
|
||||
#include "Texture.h"
|
||||
#include "ClockTexture.h"
|
||||
|
||||
ClockTexture::ClockTexture() : StitchedTexture(L"compass")
|
||||
{
|
||||
rot = rota = 0.0;
|
||||
m_dataTexture = NULL;
|
||||
m_iPad = XUSER_INDEX_ANY;
|
||||
}
|
||||
|
||||
ClockTexture::ClockTexture(int iPad, ClockTexture *dataTexture) : StitchedTexture(L"compass")
|
||||
{
|
||||
rot = rota = 0.0;
|
||||
m_dataTexture = dataTexture;
|
||||
m_iPad = iPad;
|
||||
}
|
||||
|
||||
void ClockTexture::cycleFrames()
|
||||
{
|
||||
|
||||
Minecraft *mc = Minecraft::GetInstance();
|
||||
|
||||
double rott = 0;
|
||||
if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != NULL && mc->localplayers[m_iPad] != NULL)
|
||||
{
|
||||
float time = mc->localplayers[m_iPad]->level->getTimeOfDay(1);
|
||||
rott = time;
|
||||
if (!mc->localplayers[m_iPad]->level->dimension->isNaturalDimension())
|
||||
{
|
||||
rott = Math::random();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 4J Stu - For the static version, pretend we are already on a frame other than 0
|
||||
frame = 1;
|
||||
}
|
||||
|
||||
double rotd = rott - rot;
|
||||
while (rotd < -.5)
|
||||
rotd += 1.0;
|
||||
while (rotd >= .5)
|
||||
rotd -= 1.0;
|
||||
if (rotd < -1) rotd = -1;
|
||||
if (rotd > 1) rotd = 1;
|
||||
rota += rotd * 0.1;
|
||||
rota *= 0.8;
|
||||
|
||||
rot += rota;
|
||||
|
||||
// 4J Stu - We share data with another texture
|
||||
if(m_dataTexture != NULL)
|
||||
{
|
||||
int newFrame = (int) ((rot + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size();
|
||||
while (newFrame < 0)
|
||||
{
|
||||
newFrame = (newFrame + m_dataTexture->frames->size()) % m_dataTexture->frames->size();
|
||||
}
|
||||
if (newFrame != frame)
|
||||
{
|
||||
frame = newFrame;
|
||||
m_dataTexture->source->blit(x, y, m_dataTexture->frames->at(this->frame), rotated);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int newFrame = (int) ((rot + 1.0) * frames->size()) % frames->size();
|
||||
while (newFrame < 0)
|
||||
{
|
||||
newFrame = (newFrame + frames->size()) % frames->size();
|
||||
}
|
||||
if (newFrame != frame)
|
||||
{
|
||||
frame = newFrame;
|
||||
source->blit(x, y, frames->at(this->frame), rotated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ClockTexture::getSourceWidth() const
|
||||
{
|
||||
return source->getWidth();
|
||||
}
|
||||
|
||||
int ClockTexture::getSourceHeight() const
|
||||
{
|
||||
return source->getHeight();
|
||||
}
|
||||
|
||||
int ClockTexture::getFrames()
|
||||
{
|
||||
if(m_dataTexture == NULL)
|
||||
{
|
||||
return StitchedTexture::getFrames();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_dataTexture->getFrames();
|
||||
}
|
||||
}
|
||||
|
||||
void ClockTexture::freeFrameTextures()
|
||||
{
|
||||
if(m_dataTexture == NULL)
|
||||
{
|
||||
StitchedTexture::freeFrameTextures();
|
||||
}
|
||||
}
|
||||
|
||||
bool ClockTexture::hasOwnData()
|
||||
{
|
||||
return m_dataTexture == NULL;
|
||||
}
|
||||
21
Minecraft.Client/ClockTexture.h
Normal file
21
Minecraft.Client/ClockTexture.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#pragma once
|
||||
#include "StitchedTexture.h"
|
||||
|
||||
class ClockTexture : public StitchedTexture
|
||||
{
|
||||
private:
|
||||
double rot, rota;
|
||||
int m_iPad;
|
||||
ClockTexture* m_dataTexture;
|
||||
|
||||
public:
|
||||
ClockTexture();
|
||||
ClockTexture(int iPad, ClockTexture *dataTexture);
|
||||
void cycleFrames();
|
||||
|
||||
virtual int getSourceWidth() const;
|
||||
virtual int getSourceHeight() const;
|
||||
virtual int getFrames();
|
||||
virtual void freeFrameTextures(); // 4J added
|
||||
virtual bool hasOwnData(); // 4J Added
|
||||
};
|
||||
130
Minecraft.Client/Common/App_Defines.h
Normal file
130
Minecraft.Client/Common/App_Defines.h
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
// 4J Stu - For non-splitscreen menus, default to this screen
|
||||
#define DEFAULT_XUI_MENU_USER 0
|
||||
#define MULTITHREAD_ENABLE
|
||||
#define MAX_CAPENAME_SIZE 32
|
||||
#define MAX_BANNERNAME_SIZE 32
|
||||
#define MAX_TMSFILENAME_SIZE 40
|
||||
#define MAX_TYPE_SIZE 32
|
||||
#define MAX_EXTENSION_TYPES 3
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#define MAX_LOCAL_PLAYERS 1
|
||||
#else
|
||||
#define MAX_LOCAL_PLAYERS 4
|
||||
#endif
|
||||
|
||||
// 4J Stu - Required for sentient reporting of whether the volume level has been changed or not
|
||||
#define DEFAULT_VOLUME_LEVEL 100
|
||||
|
||||
#define GAME_HOST_OPTION_BITMASK_DIFFICULTY 0x00000003 // 0 - 3
|
||||
#define GAME_HOST_OPTION_BITMASK_FRIENDSOFFRIENDS 0x00000004
|
||||
#define GAME_HOST_OPTION_BITMASK_GAMERTAGS 0x00000008
|
||||
#define GAME_HOST_OPTION_BITMASK_GAMETYPE 0x00000030
|
||||
#define GAME_HOST_OPTION_BITMASK_LEVELTYPE 0x00000040
|
||||
#define GAME_HOST_OPTION_BITMASK_STRUCTURES 0x00000080
|
||||
#define GAME_HOST_OPTION_BITMASK_BONUSCHEST 0x00000100
|
||||
#define GAME_HOST_OPTION_BITMASK_BEENINCREATIVE 0x00000200
|
||||
#define GAME_HOST_OPTION_BITMASK_PVP 0x00000400
|
||||
#define GAME_HOST_OPTION_BITMASK_TRUSTPLAYERS 0x00000800
|
||||
#define GAME_HOST_OPTION_BITMASK_TNT 0x00001000
|
||||
#define GAME_HOST_OPTION_BITMASK_FIRESPREADS 0x00002000
|
||||
#define GAME_HOST_OPTION_BITMASK_HOSTFLY 0x00004000
|
||||
#define GAME_HOST_OPTION_BITMASK_HOSTHUNGER 0x00008000
|
||||
#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_ALL 0xFFFFFFFF
|
||||
|
||||
#ifdef _XBOX
|
||||
#define PROFILE_VERSION_1 1
|
||||
#define PROFILE_VERSION_2 2
|
||||
#define PROFILE_VERSION_3 3
|
||||
#define PROFILE_VERSION_4 4
|
||||
#define PROFILE_VERSION_5 6
|
||||
#define PROFILE_VERSION_6 7
|
||||
#define PROFILE_VERSION_7 8
|
||||
#endif
|
||||
#define PROFILE_VERSION_8 10
|
||||
#define PROFILE_VERSION_9 11
|
||||
|
||||
#define PROFILE_VERSION_10 12
|
||||
|
||||
// 4J-JEV: New Statistics and Achievements for 'NexGen' platforms.
|
||||
#define PROFILE_VERSION_BUILD_JUNE14 13
|
||||
|
||||
#define MAX_FAVORITE_SKINS 10 // these are stored in the profile data so keep it small
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// defines for game settings - uiBitmaskValues
|
||||
|
||||
#define GAMESETTING_CLOUDS 0x00000001
|
||||
#define GAMESETTING_ONLINE 0x00000002
|
||||
#define GAMESETTING_INVITEONLY 0x00000004
|
||||
#define GAMESETTING_FRIENDSOFFRIENDS 0x00000008
|
||||
#define GAMESETTING_DISPLAYUPDATEMSG 0x00000030
|
||||
#define GAMESETTING_BEDROCKFOG 0x00000040
|
||||
#define GAMESETTING_DISPLAYHUD 0x00000080
|
||||
#define GAMESETTING_DISPLAYHAND 0x00000100
|
||||
#define GAMESETTING_CUSTOMSKINANIM 0x00000200
|
||||
#define GAMESETTING_DEATHMESSAGES 0x00000400
|
||||
#define GAMESETTING_UISIZE 0x00001800
|
||||
#define GAMESETTING_UISIZE_SPLITSCREEN 0x00006000
|
||||
#define GAMESETTING_ANIMATEDCHARACTER 0x00008000
|
||||
#define GAMESETTING_PS3EULAREAD 0x00010000
|
||||
#define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000
|
||||
|
||||
|
||||
// defines for languages
|
||||
|
||||
#define MINECRAFT_LANGUAGE_DEFAULT 0x00
|
||||
#define MINECRAFT_LANGUAGE_ENGLISH 0x01
|
||||
#define MINECRAFT_LANGUAGE_JAPANESE 0x02
|
||||
#define MINECRAFT_LANGUAGE_GERMAN 0x03
|
||||
#define MINECRAFT_LANGUAGE_FRENCH 0x04
|
||||
#define MINECRAFT_LANGUAGE_SPANISH 0x05
|
||||
#define MINECRAFT_LANGUAGE_ITALIAN 0x06
|
||||
#define MINECRAFT_LANGUAGE_KOREAN 0x07
|
||||
#define MINECRAFT_LANGUAGE_TCHINESE 0x08
|
||||
#define MINECRAFT_LANGUAGE_PORTUGUESE 0x09
|
||||
#define MINECRAFT_LANGUAGE_BRAZILIAN 0x0A
|
||||
#define MINECRAFT_LANGUAGE_RUSSIAN 0x0B
|
||||
#define MINECRAFT_LANGUAGE_DUTCH 0x0C
|
||||
#define MINECRAFT_LANGUAGE_FINISH 0x0D
|
||||
#define MINECRAFT_LANGUAGE_SWEDISH 0x0E
|
||||
#define MINECRAFT_LANGUAGE_DANISH 0x0F
|
||||
#define MINECRAFT_LANGUAGE_NORWEGIAN 0x10
|
||||
#define MINECRAFT_LANGUAGE_POLISH 0x11
|
||||
#define MINECRAFT_LANGUAGE_TURKISH 0x12
|
||||
#define MINECRAFT_LANGUAGE_LATINAMERICANSPANISH 0x13
|
||||
#define MINECRAFT_LANGUAGE_GREEK 0x14
|
||||
|
||||
|
||||
/* Match these
|
||||
|
||||
const int XC_LANGUAGE_ENGLISH =1;
|
||||
const int XC_LANGUAGE_JAPANESE =2;
|
||||
const int XC_LANGUAGE_GERMAN =3;
|
||||
const int XC_LANGUAGE_FRENCH =4;
|
||||
const int XC_LANGUAGE_SPANISH =5;
|
||||
const int XC_LANGUAGE_ITALIAN =6;
|
||||
const int XC_LANGUAGE_KOREAN =7;
|
||||
const int XC_LANGUAGE_TCHINESE =8;
|
||||
const int XC_LANGUAGE_PORTUGUESE =9;
|
||||
const int XC_LANGUAGE_BRAZILIAN =10;
|
||||
const int XC_LANGUAGE_RUSSIAN =11;
|
||||
const int XC_LANGUAGE_DUTCH =12;
|
||||
const int XC_LANGUAGE_FINISH =13;
|
||||
const int XC_LANGUAGE_SWEDISH =14;
|
||||
const int XC_LANGUAGE_DANISH =15;
|
||||
const int XC_LANGUAGE_NORWEGIAN =16;
|
||||
const int XC_LANGUAGE_POLISH =17;
|
||||
const int XC_LANGUAGE_TURKISH =18;
|
||||
const int XC_LANGUAGE_LATINAMERICANSPANISH =19;
|
||||
const int XC_LANGUAGE_GREEK =20;
|
||||
*/
|
||||
913
Minecraft.Client/Common/App_enums.h
Normal file
913
Minecraft.Client/Common/App_enums.h
Normal file
|
|
@ -0,0 +1,913 @@
|
|||
#pragma once
|
||||
|
||||
enum eFileExtensionType
|
||||
{
|
||||
eFileExtensionType_PNG=0,
|
||||
eFileExtensionType_INF,
|
||||
eFileExtensionType_DAT,
|
||||
};
|
||||
|
||||
enum eTMSFileType
|
||||
{
|
||||
eTMSFileType_MinecraftStore=0,
|
||||
eTMSFileType_TexturePack,
|
||||
eTMSFileType_All
|
||||
};
|
||||
|
||||
enum eTPDFileType
|
||||
{
|
||||
eTPDFileType_Loc=0,
|
||||
eTPDFileType_Icon,
|
||||
// eTPDFileType_Banner,
|
||||
eTPDFileType_Comparison,
|
||||
};
|
||||
|
||||
enum eFont
|
||||
{
|
||||
eFont_European=0,
|
||||
eFont_Korean,
|
||||
eFont_Japanese,
|
||||
eFont_Chinese,
|
||||
eFont_None, // to fallback to nothing
|
||||
};
|
||||
|
||||
enum eXuiAction
|
||||
{
|
||||
eAppAction_Idle=0,
|
||||
eAppAction_SaveGame,
|
||||
eAppAction_SaveGameCapturedThumbnail,
|
||||
eAppAction_ExitWorld,
|
||||
eAppAction_ExitWorldCapturedThumbnail,
|
||||
eAppAction_ExitWorldTrial,
|
||||
//eAppAction_ExitGameFatalLoadError,
|
||||
eAppAction_Respawn,
|
||||
eAppAction_WaitForRespawnComplete,
|
||||
eAppAction_PrimaryPlayerSignedOut,
|
||||
eAppAction_PrimaryPlayerSignedOutReturned,
|
||||
eAppAction_PrimaryPlayerSignedOutReturned_Menus,
|
||||
eAppAction_ExitPlayer, // secondary player
|
||||
eAppAction_ExitPlayerPreLogin,
|
||||
eAppAction_TrialOver,
|
||||
eAppAction_ExitTrial,
|
||||
eAppAction_WaitForDimensionChangeComplete,
|
||||
eAppAction_SocialPost,
|
||||
eAppAction_SocialPostScreenshot,
|
||||
eAppAction_EthernetDisconnected,
|
||||
eAppAction_EthernetDisconnectedReturned,
|
||||
eAppAction_EthernetDisconnectedReturned_Menus,
|
||||
eAppAction_ExitAndJoinFromInvite,
|
||||
eAppAction_DashboardTrialJoinFromInvite,
|
||||
eAppAction_ExitAndJoinFromInviteConfirmed,
|
||||
eAppAction_JoinFromInvite,
|
||||
eAppAction_ChangeSessionType,
|
||||
eAppAction_SetDefaultOptions,
|
||||
eAppAction_LocalPlayerJoined,
|
||||
eAppAction_RemoteServerSave,
|
||||
eAppAction_WaitRemoteServerSaveComplete,
|
||||
eAppAction_FailedToJoinNoPrivileges,
|
||||
eAppAction_AutosaveSaveGame,
|
||||
eAppAction_AutosaveSaveGameCapturedThumbnail,
|
||||
eAppAction_ProfileReadError,
|
||||
eAppAction_DisplayLavaMessage,
|
||||
eAppAction_BanLevel,
|
||||
eAppAction_LevelInBanLevelList,
|
||||
|
||||
eAppAction_ReloadTexturePack,
|
||||
eAppAction_TexturePackRequired, // when the user has joined from invite, but doesn't have the texture pack
|
||||
|
||||
#ifdef __ORBIS__
|
||||
eAppAction_OptionsSaveNoSpace,
|
||||
#endif
|
||||
eAppAction_DebugText,
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum eTMSAction
|
||||
{
|
||||
eTMSAction_Idle=0,
|
||||
eTMSAction_TMS_RetrieveFiles_Complete,
|
||||
eTMSAction_TMSPP_RetrieveFiles_CreateLoad_SignInReturned,
|
||||
eTMSAction_TMSPP_RetrieveFiles_RunPlayGame,
|
||||
eTMSAction_TMSPP_RetrieveFiles_HelpAndOptions,
|
||||
eTMSAction_TMSPP_RetrieveFiles_DLCMain,
|
||||
eTMSAction_TMSPP_GlobalFileList,
|
||||
eTMSAction_TMSPP_GlobalFileList_Waiting,
|
||||
// eTMSAction_TMSPP_ConfigFile,
|
||||
// eTMSAction_TMSPP_ConfigFile_Waiting,
|
||||
eTMSAction_TMSPP_UserFileList,
|
||||
eTMSAction_TMSPP_UserFileList_Waiting,
|
||||
eTMSAction_TMSPP_XUIDSFile,
|
||||
eTMSAction_TMSPP_XUIDSFile_Waiting,
|
||||
eTMSAction_TMSPP_DLCFile,
|
||||
eTMSAction_TMSPP_DLCFile_Waiting,
|
||||
eTMSAction_TMSPP_BannedListFile,
|
||||
eTMSAction_TMSPP_BannedListFile_Waiting,
|
||||
eTMSAction_TMSPP_RetrieveFiles_Complete,
|
||||
eTMSAction_TMSPP_DLCFileOnly,
|
||||
eTMSAction_TMSPP_RetrieveUserFilelist_DLCFileOnly,
|
||||
};
|
||||
|
||||
// The server runs on its own thread, so we need to call its actions there rather than where all other Xui actions are performed
|
||||
// In general these are debugging options
|
||||
enum eXuiServerAction
|
||||
{
|
||||
eXuiServerAction_Idle=0,
|
||||
eXuiServerAction_DropItem, // Debug
|
||||
eXuiServerAction_SaveGame,
|
||||
eXuiServerAction_AutoSaveGame,
|
||||
eXuiServerAction_SpawnMob, // Debug
|
||||
eXuiServerAction_PauseServer,
|
||||
eXuiServerAction_ToggleRain, // Debug
|
||||
eXuiServerAction_ToggleThunder, // Debug
|
||||
eXuiServerAction_ServerSettingChanged_Gamertags,
|
||||
eXuiServerAction_ServerSettingChanged_Difficulty,
|
||||
eXuiServerAction_ExportSchematic, //Debug
|
||||
eXuiServerAction_ServerSettingChanged_BedrockFog,
|
||||
eXuiServerAction_SetCameraLocation, //Debug
|
||||
};
|
||||
|
||||
enum eGameSetting
|
||||
{
|
||||
eGameSetting_MusicVolume=0,
|
||||
eGameSetting_SoundFXVolume,
|
||||
eGameSetting_Gamma,
|
||||
eGameSetting_Difficulty,
|
||||
eGameSetting_Sensitivity_InGame,
|
||||
eGameSetting_Sensitivity_InMenu,
|
||||
eGameSetting_ViewBob,
|
||||
eGameSetting_ControlScheme,
|
||||
eGameSetting_ControlInvertLook,
|
||||
eGameSetting_ControlSouthPaw,
|
||||
eGameSetting_SplitScreenVertical,
|
||||
eGameSetting_GamertagsVisible,
|
||||
// Interim TU 1.6.6
|
||||
eGameSetting_Autosave,
|
||||
eGameSetting_DisplaySplitscreenGamertags,
|
||||
eGameSetting_Hints,
|
||||
eGameSetting_InterfaceOpacity,
|
||||
eGameSetting_Tooltips,
|
||||
// TU5
|
||||
eGameSetting_Clouds,
|
||||
eGameSetting_Online,
|
||||
eGameSetting_InviteOnly,
|
||||
eGameSetting_FriendsOfFriends,
|
||||
eGameSetting_DisplayUpdateMessage,
|
||||
|
||||
// TU6
|
||||
eGameSetting_BedrockFog,
|
||||
eGameSetting_DisplayHUD,
|
||||
eGameSetting_DisplayHand,
|
||||
|
||||
// TU7
|
||||
eGameSetting_CustomSkinAnim,
|
||||
|
||||
// TU9
|
||||
eGameSetting_DeathMessages,
|
||||
eGameSetting_UISize,
|
||||
eGameSetting_UISizeSplitscreen,
|
||||
eGameSetting_AnimatedCharacter,
|
||||
|
||||
// PS3
|
||||
eGameSetting_PS3_EULA_Read,
|
||||
|
||||
// PSVita
|
||||
eGameSetting_PSVita_NetworkModeAdhoc,
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum eGameMode
|
||||
{
|
||||
eMode_Singleplayer,
|
||||
eMode_Multiplayer
|
||||
};
|
||||
|
||||
|
||||
enum eMinecraftColour
|
||||
{
|
||||
eMinecraftColour_NOT_SET,
|
||||
|
||||
eMinecraftColour_Foliage_Evergreen,
|
||||
eMinecraftColour_Foliage_Birch,
|
||||
eMinecraftColour_Foliage_Default,
|
||||
eMinecraftColour_Foliage_Common,
|
||||
eMinecraftColour_Foliage_Ocean,
|
||||
eMinecraftColour_Foliage_Plains,
|
||||
eMinecraftColour_Foliage_Desert,
|
||||
eMinecraftColour_Foliage_ExtremeHills,
|
||||
eMinecraftColour_Foliage_Forest,
|
||||
eMinecraftColour_Foliage_Taiga,
|
||||
eMinecraftColour_Foliage_Swampland,
|
||||
eMinecraftColour_Foliage_River,
|
||||
eMinecraftColour_Foliage_Hell,
|
||||
eMinecraftColour_Foliage_Sky,
|
||||
eMinecraftColour_Foliage_FrozenOcean,
|
||||
eMinecraftColour_Foliage_FrozenRiver,
|
||||
eMinecraftColour_Foliage_IcePlains,
|
||||
eMinecraftColour_Foliage_IceMountains,
|
||||
eMinecraftColour_Foliage_MushroomIsland,
|
||||
eMinecraftColour_Foliage_MushroomIslandShore,
|
||||
eMinecraftColour_Foliage_Beach,
|
||||
eMinecraftColour_Foliage_DesertHills,
|
||||
eMinecraftColour_Foliage_ForestHills,
|
||||
eMinecraftColour_Foliage_TaigaHills,
|
||||
eMinecraftColour_Foliage_ExtremeHillsEdge,
|
||||
eMinecraftColour_Foliage_Jungle,
|
||||
eMinecraftColour_Foliage_JungleHills,
|
||||
|
||||
eMinecraftColour_Grass_Common,
|
||||
eMinecraftColour_Grass_Ocean,
|
||||
eMinecraftColour_Grass_Plains,
|
||||
eMinecraftColour_Grass_Desert,
|
||||
eMinecraftColour_Grass_ExtremeHills,
|
||||
eMinecraftColour_Grass_Forest,
|
||||
eMinecraftColour_Grass_Taiga,
|
||||
eMinecraftColour_Grass_Swampland,
|
||||
eMinecraftColour_Grass_River,
|
||||
eMinecraftColour_Grass_Hell,
|
||||
eMinecraftColour_Grass_Sky,
|
||||
eMinecraftColour_Grass_FrozenOcean,
|
||||
eMinecraftColour_Grass_FrozenRiver,
|
||||
eMinecraftColour_Grass_IcePlains,
|
||||
eMinecraftColour_Grass_IceMountains,
|
||||
eMinecraftColour_Grass_MushroomIsland,
|
||||
eMinecraftColour_Grass_MushroomIslandShore,
|
||||
eMinecraftColour_Grass_Beach,
|
||||
eMinecraftColour_Grass_DesertHills,
|
||||
eMinecraftColour_Grass_ForestHills,
|
||||
eMinecraftColour_Grass_TaigaHills,
|
||||
eMinecraftColour_Grass_ExtremeHillsEdge,
|
||||
eMinecraftColour_Grass_Jungle,
|
||||
eMinecraftColour_Grass_JungleHills,
|
||||
|
||||
eMinecraftColour_Water_Ocean,
|
||||
eMinecraftColour_Water_Plains,
|
||||
eMinecraftColour_Water_Desert,
|
||||
eMinecraftColour_Water_ExtremeHills,
|
||||
eMinecraftColour_Water_Forest,
|
||||
eMinecraftColour_Water_Taiga,
|
||||
eMinecraftColour_Water_Swampland,
|
||||
eMinecraftColour_Water_River,
|
||||
eMinecraftColour_Water_Hell,
|
||||
eMinecraftColour_Water_Sky,
|
||||
eMinecraftColour_Water_FrozenOcean,
|
||||
eMinecraftColour_Water_FrozenRiver,
|
||||
eMinecraftColour_Water_IcePlains,
|
||||
eMinecraftColour_Water_IceMountains,
|
||||
eMinecraftColour_Water_MushroomIsland,
|
||||
eMinecraftColour_Water_MushroomIslandShore,
|
||||
eMinecraftColour_Water_Beach,
|
||||
eMinecraftColour_Water_DesertHills,
|
||||
eMinecraftColour_Water_ForestHills,
|
||||
eMinecraftColour_Water_TaigaHills,
|
||||
eMinecraftColour_Water_ExtremeHillsEdge,
|
||||
eMinecraftColour_Water_Jungle,
|
||||
eMinecraftColour_Water_JungleHills,
|
||||
|
||||
eMinecraftColour_Sky_Ocean,
|
||||
eMinecraftColour_Sky_Plains,
|
||||
eMinecraftColour_Sky_Desert,
|
||||
eMinecraftColour_Sky_ExtremeHills,
|
||||
eMinecraftColour_Sky_Forest,
|
||||
eMinecraftColour_Sky_Taiga,
|
||||
eMinecraftColour_Sky_Swampland,
|
||||
eMinecraftColour_Sky_River,
|
||||
eMinecraftColour_Sky_Hell,
|
||||
eMinecraftColour_Sky_Sky,
|
||||
eMinecraftColour_Sky_FrozenOcean,
|
||||
eMinecraftColour_Sky_FrozenRiver,
|
||||
eMinecraftColour_Sky_IcePlains,
|
||||
eMinecraftColour_Sky_IceMountains,
|
||||
eMinecraftColour_Sky_MushroomIsland,
|
||||
eMinecraftColour_Sky_MushroomIslandShore,
|
||||
eMinecraftColour_Sky_Beach,
|
||||
eMinecraftColour_Sky_DesertHills,
|
||||
eMinecraftColour_Sky_ForestHills,
|
||||
eMinecraftColour_Sky_TaigaHills,
|
||||
eMinecraftColour_Sky_ExtremeHillsEdge,
|
||||
eMinecraftColour_Sky_Jungle,
|
||||
eMinecraftColour_Sky_JungleHills,
|
||||
|
||||
eMinecraftColour_Tile_RedstoneDust,
|
||||
eMinecraftColour_Tile_RedstoneDustUnlit,
|
||||
eMinecraftColour_Tile_RedstoneDustLitMin,
|
||||
eMinecraftColour_Tile_RedstoneDustLitMax,
|
||||
eMinecraftColour_Tile_StemMin,
|
||||
eMinecraftColour_Tile_StemMax,
|
||||
eMinecraftColour_Tile_WaterLily,
|
||||
|
||||
eMinecraftColour_Sky_Dawn_Dark,
|
||||
eMinecraftColour_Sky_Dawn_Bright,
|
||||
|
||||
eMinecraftColour_Material_None,
|
||||
eMinecraftColour_Material_Grass,
|
||||
eMinecraftColour_Material_Sand,
|
||||
eMinecraftColour_Material_Cloth,
|
||||
eMinecraftColour_Material_Fire,
|
||||
eMinecraftColour_Material_Ice,
|
||||
eMinecraftColour_Material_Metal,
|
||||
eMinecraftColour_Material_Plant,
|
||||
eMinecraftColour_Material_Snow,
|
||||
eMinecraftColour_Material_Clay,
|
||||
eMinecraftColour_Material_Dirt,
|
||||
eMinecraftColour_Material_Stone,
|
||||
eMinecraftColour_Material_Water,
|
||||
eMinecraftColour_Material_Wood,
|
||||
eMinecraftColour_Material_Emerald,
|
||||
|
||||
eMinecraftColour_Particle_Note_00,
|
||||
eMinecraftColour_Particle_Note_01,
|
||||
eMinecraftColour_Particle_Note_02,
|
||||
eMinecraftColour_Particle_Note_03,
|
||||
eMinecraftColour_Particle_Note_04,
|
||||
eMinecraftColour_Particle_Note_05,
|
||||
eMinecraftColour_Particle_Note_06,
|
||||
eMinecraftColour_Particle_Note_07,
|
||||
eMinecraftColour_Particle_Note_08,
|
||||
eMinecraftColour_Particle_Note_09,
|
||||
eMinecraftColour_Particle_Note_10,
|
||||
eMinecraftColour_Particle_Note_11,
|
||||
eMinecraftColour_Particle_Note_12,
|
||||
eMinecraftColour_Particle_Note_13,
|
||||
eMinecraftColour_Particle_Note_14,
|
||||
eMinecraftColour_Particle_Note_15,
|
||||
eMinecraftColour_Particle_Note_16,
|
||||
eMinecraftColour_Particle_Note_17,
|
||||
eMinecraftColour_Particle_Note_18,
|
||||
eMinecraftColour_Particle_Note_19,
|
||||
eMinecraftColour_Particle_Note_20,
|
||||
eMinecraftColour_Particle_Note_21,
|
||||
eMinecraftColour_Particle_Note_22,
|
||||
eMinecraftColour_Particle_Note_23,
|
||||
eMinecraftColour_Particle_Note_24,
|
||||
|
||||
eMinecraftColour_Particle_NetherPortal,
|
||||
eMinecraftColour_Particle_EnderPortal,
|
||||
eMinecraftColour_Particle_Smoke,
|
||||
eMinecraftColour_Particle_Ender,
|
||||
eMinecraftColour_Particle_Explode,
|
||||
eMinecraftColour_Particle_HugeExplosion,
|
||||
eMinecraftColour_Particle_DripWater,
|
||||
eMinecraftColour_Particle_DripLavaStart,
|
||||
eMinecraftColour_Particle_DripLavaEnd,
|
||||
eMinecraftColour_Particle_EnchantmentTable,
|
||||
eMinecraftColour_Particle_DragonBreathMin,
|
||||
eMinecraftColour_Particle_DragonBreathMax,
|
||||
eMinecraftColour_Particle_Suspend,
|
||||
eMinecraftColour_Particle_CritStart,
|
||||
eMinecraftColour_Particle_CritEnd,
|
||||
|
||||
eMinecraftColour_Effect_MovementSpeed,
|
||||
eMinecraftColour_Effect_MovementSlowDown,
|
||||
eMinecraftColour_Effect_DigSpeed,
|
||||
eMinecraftColour_Effect_DigSlowdown,
|
||||
eMinecraftColour_Effect_DamageBoost,
|
||||
eMinecraftColour_Effect_Heal,
|
||||
eMinecraftColour_Effect_Harm,
|
||||
eMinecraftColour_Effect_Jump,
|
||||
eMinecraftColour_Effect_Confusion,
|
||||
eMinecraftColour_Effect_Regeneration,
|
||||
eMinecraftColour_Effect_DamageResistance,
|
||||
eMinecraftColour_Effect_FireResistance,
|
||||
eMinecraftColour_Effect_WaterBreathing,
|
||||
eMinecraftColour_Effect_Invisiblity,
|
||||
eMinecraftColour_Effect_Blindness,
|
||||
eMinecraftColour_Effect_NightVision,
|
||||
eMinecraftColour_Effect_Hunger,
|
||||
eMinecraftColour_Effect_Weakness,
|
||||
eMinecraftColour_Effect_Poison,
|
||||
|
||||
eMinecraftColour_Potion_BaseColour,
|
||||
|
||||
eMinecraftColour_Mob_Creeper_Colour1,
|
||||
eMinecraftColour_Mob_Creeper_Colour2,
|
||||
eMinecraftColour_Mob_Skeleton_Colour1,
|
||||
eMinecraftColour_Mob_Skeleton_Colour2,
|
||||
eMinecraftColour_Mob_Spider_Colour1,
|
||||
eMinecraftColour_Mob_Spider_Colour2,
|
||||
eMinecraftColour_Mob_Zombie_Colour1,
|
||||
eMinecraftColour_Mob_Zombie_Colour2,
|
||||
eMinecraftColour_Mob_Slime_Colour1,
|
||||
eMinecraftColour_Mob_Slime_Colour2,
|
||||
eMinecraftColour_Mob_Ghast_Colour1,
|
||||
eMinecraftColour_Mob_Ghast_Colour2,
|
||||
eMinecraftColour_Mob_PigZombie_Colour1,
|
||||
eMinecraftColour_Mob_PigZombie_Colour2,
|
||||
eMinecraftColour_Mob_Enderman_Colour1,
|
||||
eMinecraftColour_Mob_Enderman_Colour2,
|
||||
eMinecraftColour_Mob_CaveSpider_Colour1,
|
||||
eMinecraftColour_Mob_CaveSpider_Colour2,
|
||||
eMinecraftColour_Mob_Silverfish_Colour1,
|
||||
eMinecraftColour_Mob_Silverfish_Colour2,
|
||||
eMinecraftColour_Mob_Blaze_Colour1,
|
||||
eMinecraftColour_Mob_Blaze_Colour2,
|
||||
eMinecraftColour_Mob_LavaSlime_Colour1,
|
||||
eMinecraftColour_Mob_LavaSlime_Colour2,
|
||||
eMinecraftColour_Mob_Pig_Colour1,
|
||||
eMinecraftColour_Mob_Pig_Colour2,
|
||||
eMinecraftColour_Mob_Sheep_Colour1,
|
||||
eMinecraftColour_Mob_Sheep_Colour2,
|
||||
eMinecraftColour_Mob_Cow_Colour1,
|
||||
eMinecraftColour_Mob_Cow_Colour2,
|
||||
eMinecraftColour_Mob_Chicken_Colour1,
|
||||
eMinecraftColour_Mob_Chicken_Colour2,
|
||||
eMinecraftColour_Mob_Squid_Colour1,
|
||||
eMinecraftColour_Mob_Squid_Colour2,
|
||||
eMinecraftColour_Mob_Wolf_Colour1,
|
||||
eMinecraftColour_Mob_Wolf_Colour2,
|
||||
eMinecraftColour_Mob_MushroomCow_Colour1,
|
||||
eMinecraftColour_Mob_MushroomCow_Colour2,
|
||||
eMinecraftColour_Mob_Ocelot_Colour1,
|
||||
eMinecraftColour_Mob_Ocelot_Colour2,
|
||||
eMinecraftColour_Mob_Villager_Colour1,
|
||||
eMinecraftColour_Mob_Villager_Colour2,
|
||||
|
||||
eMinecraftColour_Armour_Default_Leather_Colour,
|
||||
|
||||
eMinecraftColour_Under_Water_Clear_Colour,
|
||||
eMinecraftColour_Under_Lava_Clear_Colour,
|
||||
eMinecraftColour_In_Cloud_Base_Colour,
|
||||
|
||||
eMinecraftColour_Under_Water_Fog_Colour,
|
||||
eMinecraftColour_Under_Lava_Fog_Colour,
|
||||
eMinecraftColour_In_Cloud_Fog_Colour,
|
||||
|
||||
eMinecraftColour_Default_Fog_Colour,
|
||||
eMinecraftColour_Nether_Fog_Colour,
|
||||
eMinecraftColour_End_Fog_Colour,
|
||||
|
||||
eMinecraftColour_Sign_Text,
|
||||
eMinecraftColour_Map_Text,
|
||||
|
||||
eHTMLColor_0,
|
||||
eHTMLColor_1,
|
||||
eHTMLColor_2,
|
||||
eHTMLColor_3,
|
||||
eHTMLColor_4,
|
||||
eHTMLColor_5,
|
||||
eHTMLColor_6,
|
||||
eHTMLColor_7,
|
||||
eHTMLColor_8,
|
||||
eHTMLColor_9,
|
||||
eHTMLColor_a,
|
||||
eHTMLColor_b,
|
||||
eHTMLColor_c,
|
||||
eHTMLColor_d,
|
||||
eHTMLColor_e,
|
||||
eHTMLColor_f,
|
||||
eHTMLColor_0_dark,
|
||||
eHTMLColor_1_dark,
|
||||
eHTMLColor_2_dark,
|
||||
eHTMLColor_3_dark,
|
||||
eHTMLColor_4_dark,
|
||||
eHTMLColor_5_dark,
|
||||
eHTMLColor_6_dark,
|
||||
eHTMLColor_7_dark,
|
||||
eHTMLColor_8_dark,
|
||||
eHTMLColor_9_dark,
|
||||
eHTMLColor_a_dark,
|
||||
eHTMLColor_b_dark,
|
||||
eHTMLColor_c_dark,
|
||||
eHTMLColor_d_dark,
|
||||
eHTMLColor_e_dark,
|
||||
eHTMLColor_f_dark,
|
||||
eHTMLColor_T1,
|
||||
eHTMLColor_T2,
|
||||
eHTMLColor_T3,
|
||||
eHTMLColor_Black,
|
||||
eHTMLColor_White,
|
||||
|
||||
eTextColor_Enchant,
|
||||
eTextColor_EnchantFocus,
|
||||
eTextColor_EnchantDisabled,
|
||||
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_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
|
||||
//eHTMLColor_2_dark = 0x002a00, //r:0 , g: 2a, b: 0, i: 12
|
||||
//eHTMLColor_3_dark = 0x002a2a, //r:0 , g: 2a, b: 2a, i: 13
|
||||
//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_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_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
|
||||
|
||||
eMinecraftColour_COUNT,
|
||||
};
|
||||
|
||||
enum eDLCContentType
|
||||
{
|
||||
e_DLC_SkinPack=0,
|
||||
e_DLC_TexturePacks,
|
||||
e_DLC_MashupPacks,
|
||||
e_DLC_Themes,
|
||||
e_DLC_AvatarItems,
|
||||
e_DLC_Gamerpics,
|
||||
e_DLC_MAX_MinecraftStore,
|
||||
e_DLC_TexturePackData, // for the icon, banner and text
|
||||
e_DLC_MAX,
|
||||
e_DLC_NotDefined,
|
||||
};
|
||||
|
||||
enum eDLCMarketplaceType
|
||||
{
|
||||
e_Marketplace_Content=0, // skins, texture packs and mashup packs
|
||||
e_Marketplace_Themes,
|
||||
e_Marketplace_AvatarItems,
|
||||
e_Marketplace_Gamerpics,
|
||||
e_Marketplace_MAX,
|
||||
e_Marketplace_NotDefined,
|
||||
};
|
||||
|
||||
enum eDLCContentState
|
||||
{
|
||||
e_DLC_ContentState_Idle = 0,
|
||||
e_DLC_ContentState_Retrieving,
|
||||
e_DLC_ContentState_Retrieved
|
||||
};
|
||||
|
||||
enum eTMSContentState
|
||||
{
|
||||
e_TMS_ContentState_Idle = 0,
|
||||
e_TMS_ContentState_Queued,
|
||||
e_TMS_ContentState_Retrieving,
|
||||
e_TMS_ContentState_Retrieved
|
||||
};
|
||||
|
||||
enum eXUID
|
||||
{
|
||||
eXUID_Undefined=0,
|
||||
eXUID_NoName, // name not needed
|
||||
eXUID_Notch,
|
||||
eXUID_Carl,
|
||||
eXUID_Daniel,
|
||||
eXUID_Deadmau5,
|
||||
eXUID_DannyBStyle,
|
||||
eXUID_JulianClark,
|
||||
eXUID_Millionth,
|
||||
eXUID_4JPaddy,
|
||||
eXUID_4JStuart,
|
||||
eXUID_4JDavid,
|
||||
eXUID_4JRichard,
|
||||
eXUID_4JSteven,
|
||||
};
|
||||
|
||||
|
||||
enum _eTerrainFeatureType
|
||||
{
|
||||
eTerrainFeature_None=0,
|
||||
eTerrainFeature_Stronghold,
|
||||
eTerrainFeature_Mineshaft,
|
||||
eTerrainFeature_Village,
|
||||
eTerrainFeature_Ravine,
|
||||
eTerrainFeature_NetherFortress,
|
||||
eTerrainFeature_StrongholdEndPortal,
|
||||
eTerrainFeature_Count
|
||||
};
|
||||
|
||||
// 4J Stu - Whend adding new options you should consider whether having them on should disable achievements, and if so add them to the CanRecordStatsAndAchievements function
|
||||
// 4J Stu - These options are now saved in save data, so new options can ONLY be added to the end
|
||||
enum eGameHostOption
|
||||
{
|
||||
eGameHostOption_Difficulty=0,
|
||||
eGameHostOption_OnlineGame, // Unused
|
||||
eGameHostOption_InviteOnly, // Unused
|
||||
eGameHostOption_FriendsOfFriends,
|
||||
eGameHostOption_Gamertags,
|
||||
eGameHostOption_Tutorial, // special case
|
||||
eGameHostOption_GameType,
|
||||
eGameHostOption_LevelType, // flat or default
|
||||
eGameHostOption_Structures,
|
||||
eGameHostOption_BonusChest,
|
||||
eGameHostOption_HasBeenInCreative,
|
||||
eGameHostOption_PvP,
|
||||
eGameHostOption_TrustPlayers,
|
||||
eGameHostOption_TNT,
|
||||
eGameHostOption_FireSpreads,
|
||||
eGameHostOption_CheatsEnabled, // special case
|
||||
eGameHostOption_HostCanFly,
|
||||
eGameHostOption_HostCanChangeHunger,
|
||||
eGameHostOption_HostCanBeInvisible,
|
||||
eGameHostOption_BedrockFog,
|
||||
eGameHostOption_NoHUD,
|
||||
eGameHostOption_All,
|
||||
|
||||
eGameHostOption_DisableSaving,
|
||||
};
|
||||
|
||||
// 4J-PB - If any new DLC items are added to the TMSFiles, this array needs updated
|
||||
#ifdef _XBOX
|
||||
enum _TMSFILES
|
||||
{
|
||||
TMS_SP1=0,
|
||||
TMS_SP2,
|
||||
TMS_SP3,
|
||||
TMS_SP4,
|
||||
TMS_SP5,
|
||||
TMS_SP6,
|
||||
TMS_SPF,
|
||||
TMS_SPB,
|
||||
TMS_SPC,
|
||||
TMS_SPZ,
|
||||
TMS_SPM,
|
||||
TMS_SPI,
|
||||
TMS_SPG,
|
||||
|
||||
TMS_THST,
|
||||
TMS_THIR,
|
||||
TMS_THGO,
|
||||
TMS_THDI,
|
||||
TMS_THAW,
|
||||
|
||||
TMS_GPAN,
|
||||
TMS_GPCO,
|
||||
TMS_GPEN,
|
||||
TMS_GPFO,
|
||||
TMS_GPTO,
|
||||
TMS_GPBA,
|
||||
TMS_GPFA,
|
||||
TMS_GPME,
|
||||
TMS_GPMF,
|
||||
TMS_GPMM,
|
||||
TMS_GPSE,
|
||||
TMS_GPOr,
|
||||
TMS_GPMi,
|
||||
TMS_GPMB,
|
||||
TMS_GPBr,
|
||||
TMS_GPM1,
|
||||
TMS_GPM2,
|
||||
TMS_GPM3,
|
||||
|
||||
TMS_AH_0001,
|
||||
TMS_AH_0002,
|
||||
TMS_AH_0003,
|
||||
TMS_AH_0004,
|
||||
TMS_AH_0005,
|
||||
TMS_AH_0006,
|
||||
TMS_AH_0007,
|
||||
TMS_AH_0008,
|
||||
TMS_AH_0009,
|
||||
TMS_AH_0010,
|
||||
TMS_AH_0011,
|
||||
TMS_AH_0012,
|
||||
TMS_AH_0013,
|
||||
|
||||
TMS_AT_0001,
|
||||
TMS_AT_0002,
|
||||
TMS_AT_0003,
|
||||
TMS_AT_0004,
|
||||
TMS_AT_0005,
|
||||
TMS_AT_0006,
|
||||
TMS_AT_0007,
|
||||
TMS_AT_0008,
|
||||
TMS_AT_0009,
|
||||
TMS_AT_0010,
|
||||
TMS_AT_0011,
|
||||
TMS_AT_0012,
|
||||
TMS_AT_0013,
|
||||
TMS_AT_0014,
|
||||
TMS_AT_0015,
|
||||
TMS_AT_0016,
|
||||
TMS_AT_0017,
|
||||
TMS_AT_0018,
|
||||
TMS_AT_0019,
|
||||
TMS_AT_0020,
|
||||
TMS_AT_0021,
|
||||
TMS_AT_0022,
|
||||
TMS_AT_0023,
|
||||
TMS_AT_0024,
|
||||
TMS_AT_0025,
|
||||
TMS_AT_0026,
|
||||
|
||||
TMS_AP_0001,
|
||||
TMS_AP_0002,
|
||||
TMS_AP_0003,
|
||||
TMS_AP_0004,
|
||||
TMS_AP_0005,
|
||||
TMS_AP_0006,
|
||||
TMS_AP_0007,
|
||||
TMS_AP_0009,
|
||||
TMS_AP_0010,
|
||||
TMS_AP_0011,
|
||||
TMS_AP_0012,
|
||||
TMS_AP_0013,
|
||||
TMS_AP_0014,
|
||||
TMS_AP_0015,
|
||||
TMS_AP_0016,
|
||||
TMS_AP_0017,
|
||||
TMS_AP_0018,
|
||||
|
||||
TMS_AP_0019,
|
||||
TMS_AP_0020,
|
||||
TMS_AP_0021,
|
||||
TMS_AP_0022,
|
||||
TMS_AP_0023,
|
||||
TMS_AP_0024,
|
||||
TMS_AP_0025,
|
||||
TMS_AP_0026,
|
||||
TMS_AP_0027,
|
||||
TMS_AP_0028,
|
||||
TMS_AP_0029,
|
||||
TMS_AP_0030,
|
||||
TMS_AP_0031,
|
||||
TMS_AP_0032,
|
||||
TMS_AP_0033,
|
||||
|
||||
TMS_AA_0001,
|
||||
|
||||
TMS_MPMA,
|
||||
TMS_MPMA_DAT,
|
||||
TMS_MPSR,
|
||||
TMS_MPSR_DAT,
|
||||
TMS_MPHA,
|
||||
TMS_MPHA_DAT,
|
||||
|
||||
TMS_TP01,
|
||||
TMS_TP01_DAT,
|
||||
TMS_TP02,
|
||||
TMS_TP02_DAT,
|
||||
TMS_TP04,
|
||||
TMS_TP04_DAT,
|
||||
TMS_TP05,
|
||||
TMS_TP05_DAT,
|
||||
TMS_TP06,
|
||||
TMS_TP06_DAT,
|
||||
TMS_TP07,
|
||||
TMS_TP07_DAT,
|
||||
|
||||
TMS_COUNT
|
||||
};
|
||||
#endif
|
||||
|
||||
enum EHTMLFontSize
|
||||
{
|
||||
eHTMLSize_Normal,
|
||||
eHTMLSize_Splitscreen,
|
||||
eHTMLSize_Tutorial,
|
||||
eHTMLSize_EndPoem,
|
||||
|
||||
eHTMLSize_COUNT,
|
||||
};
|
||||
|
||||
enum EControllerActions
|
||||
{
|
||||
ACTION_MENU_A,
|
||||
ACTION_MENU_B,
|
||||
ACTION_MENU_X,
|
||||
ACTION_MENU_Y,
|
||||
ACTION_MENU_UP,
|
||||
ACTION_MENU_DOWN,
|
||||
ACTION_MENU_RIGHT,
|
||||
ACTION_MENU_LEFT,
|
||||
ACTION_MENU_PAGEUP,
|
||||
ACTION_MENU_PAGEDOWN,
|
||||
ACTION_MENU_RIGHT_SCROLL,
|
||||
ACTION_MENU_LEFT_SCROLL,
|
||||
ACTION_MENU_STICK_PRESS,
|
||||
ACTION_MENU_OTHER_STICK_PRESS,
|
||||
ACTION_MENU_OTHER_STICK_UP,
|
||||
ACTION_MENU_OTHER_STICK_DOWN,
|
||||
ACTION_MENU_OTHER_STICK_LEFT,
|
||||
ACTION_MENU_OTHER_STICK_RIGHT,
|
||||
ACTION_MENU_PAUSEMENU,
|
||||
|
||||
#ifdef _DURANGO
|
||||
ACTION_MENU_GTC_PAUSE,
|
||||
ACTION_MENU_GTC_RESUME,
|
||||
#endif
|
||||
|
||||
#ifdef __ORBIS__
|
||||
ACTION_MENU_TOUCHPAD_PRESS,
|
||||
#endif
|
||||
|
||||
ACTION_MENU_OK,
|
||||
ACTION_MENU_CANCEL,
|
||||
ACTION_MAX_MENU = ACTION_MENU_CANCEL,
|
||||
|
||||
MINECRAFT_ACTION_JUMP,
|
||||
MINECRAFT_ACTION_FORWARD,
|
||||
MINECRAFT_ACTION_BACKWARD,
|
||||
MINECRAFT_ACTION_LEFT,
|
||||
MINECRAFT_ACTION_RIGHT,
|
||||
MINECRAFT_ACTION_LOOK_LEFT,
|
||||
MINECRAFT_ACTION_LOOK_RIGHT,
|
||||
MINECRAFT_ACTION_LOOK_UP,
|
||||
MINECRAFT_ACTION_LOOK_DOWN,
|
||||
MINECRAFT_ACTION_USE,
|
||||
MINECRAFT_ACTION_ACTION,
|
||||
MINECRAFT_ACTION_LEFT_SCROLL,
|
||||
MINECRAFT_ACTION_RIGHT_SCROLL,
|
||||
MINECRAFT_ACTION_INVENTORY,
|
||||
MINECRAFT_ACTION_PAUSEMENU,
|
||||
MINECRAFT_ACTION_DROP,
|
||||
MINECRAFT_ACTION_SNEAK_TOGGLE,
|
||||
MINECRAFT_ACTION_CRAFTING,
|
||||
MINECRAFT_ACTION_RENDER_THIRD_PERSON,
|
||||
MINECRAFT_ACTION_GAME_INFO,
|
||||
MINECRAFT_ACTION_DPAD_LEFT,
|
||||
MINECRAFT_ACTION_DPAD_RIGHT,
|
||||
MINECRAFT_ACTION_DPAD_UP,
|
||||
MINECRAFT_ACTION_DPAD_DOWN,
|
||||
|
||||
MINECRAFT_ACTION_MAX,
|
||||
|
||||
// These 4 aren't mapped to the input manager directly but are created from the dpad controls if required in Minecraft::run_middle
|
||||
// Don't use them with the input manager directly, just through LocalPlayer::ullButtonsPressed
|
||||
MINECRAFT_ACTION_SPAWN_CREEPER,
|
||||
MINECRAFT_ACTION_CHANGE_SKIN,
|
||||
MINECRAFT_ACTION_FLY_TOGGLE,
|
||||
MINECRAFT_ACTION_RENDER_DEBUG
|
||||
};
|
||||
|
||||
enum eMCLang
|
||||
{
|
||||
eMCLang_null=0,
|
||||
eMCLang_enUS,
|
||||
eMCLang_enGB,
|
||||
eMCLang_enIE,
|
||||
eMCLang_enAU,
|
||||
eMCLang_enNZ,
|
||||
eMCLang_enCA,
|
||||
eMCLang_jaJP,
|
||||
eMCLang_deDE,
|
||||
eMCLang_deAT,
|
||||
eMCLang_frFR,
|
||||
eMCLang_frCA,
|
||||
eMCLang_esES,
|
||||
eMCLang_esMX,
|
||||
eMCLang_itIT,
|
||||
eMCLang_koKR,
|
||||
eMCLang_ptPT,
|
||||
eMCLang_ptBR,
|
||||
eMCLang_ruRU,
|
||||
eMCLang_nlNL,
|
||||
eMCLang_fiFI,
|
||||
eMCLang_svSV,
|
||||
eMCLang_daDA,
|
||||
eMCLang_noNO,
|
||||
eMCLang_plPL,
|
||||
eMCLang_trTR,
|
||||
eMCLang_elEL,
|
||||
eMCLang_zhCHS,
|
||||
eMCLang_zhCHT,
|
||||
eMCLang_laLAS,
|
||||
|
||||
eMCLang_zhSG,
|
||||
eMCLang_zhCN,
|
||||
eMCLang_zhHK,
|
||||
eMCLang_zhTW,
|
||||
eMCLang_nlBE,
|
||||
eMCLang_daDK,
|
||||
eMCLang_frBE,
|
||||
eMCLang_frCH,
|
||||
eMCLang_deCH,
|
||||
eMCLang_nbNO,
|
||||
eMCLang_enGR,
|
||||
eMCLang_enHK,
|
||||
eMCLang_enSA,
|
||||
eMCLang_enHU,
|
||||
eMCLang_enIN,
|
||||
eMCLang_enIL,
|
||||
eMCLang_enSG,
|
||||
eMCLang_enSK,
|
||||
eMCLang_enZA,
|
||||
eMCLang_enCZ,
|
||||
eMCLang_enAE,
|
||||
eMCLang_esAR,
|
||||
eMCLang_esCL,
|
||||
eMCLang_esCO,
|
||||
eMCLang_esUS,
|
||||
eMCLang_svSE,
|
||||
|
||||
eMCLang_csCZ,
|
||||
eMCLang_elGR,
|
||||
eMCLang_nnNO,
|
||||
eMCLang_skSK,
|
||||
};
|
||||
227
Minecraft.Client/Common/App_structs.h
Normal file
227
Minecraft.Client/Common/App_structs.h
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
#pragma once
|
||||
|
||||
typedef struct
|
||||
{
|
||||
wchar_t *wchFilename;
|
||||
eFileExtensionType eEXT;
|
||||
eTMSFileType eTMSType;
|
||||
PBYTE pbData;
|
||||
UINT uiSize;
|
||||
int iConfig; // used for texture pack data files
|
||||
}
|
||||
TMS_FILE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PBYTE pbData;
|
||||
DWORD dwBytes;
|
||||
BYTE ucRefCount;
|
||||
}
|
||||
MEMDATA,*PMEMDATA;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwNotification;
|
||||
UINT uiParam;
|
||||
}
|
||||
NOTIFICATION,*PNOTIFICATION;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool bSettingsChanged;
|
||||
unsigned char ucMusicVolume;
|
||||
unsigned char ucSoundFXVolume;
|
||||
unsigned char ucSensitivity;
|
||||
unsigned char ucGamma;
|
||||
unsigned char ucPad01; // 1 byte of padding inserted here
|
||||
unsigned short usBitmaskValues; // bit 0,1 - difficulty
|
||||
// bit 2 - view bob
|
||||
// bit 3 - player visible in a map
|
||||
// bit 4,5 - control scheme
|
||||
// bit 6 - invert look
|
||||
// bit 7 - southpaw
|
||||
// bit 8 - splitscreen vertical
|
||||
|
||||
// 4J-PB - Adding new values for interim TU for 1.6.6
|
||||
// bit 9 - Display gamertags in splitscreen
|
||||
// bit 10 - Disable/Enable hints
|
||||
// bit 11,12,13,14 - Autosave frequency - 0 = Off, 8 = (8*15 minutes) = 2 hours
|
||||
// bit 15 Tooltips
|
||||
|
||||
// debug values
|
||||
unsigned int uiDebugBitmask;
|
||||
|
||||
// block off space to use for whatever we want (e.g bitflags for storing things the player has done in the game, so we can flag the first time they do things, such as sleep)
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned char ucTutorialCompletion[TUTORIAL_PROFILE_STORAGE_BYTES];
|
||||
// adding new flags for interim TU to 1.6.6
|
||||
|
||||
// A value that encodes the skin that the player has set as their default
|
||||
DWORD dwSelectedSkin;
|
||||
|
||||
// In-Menu sensitivity
|
||||
unsigned char ucMenuSensitivity;
|
||||
unsigned char ucInterfaceOpacity;
|
||||
unsigned char ucPad02;//2 bytes of padding added here
|
||||
unsigned char usPad03;
|
||||
|
||||
// Adding another bitmask flag for more settings for 1.8.2
|
||||
unsigned int uiBitmaskValues; // 0x00000001 - eGameSetting_Clouds - on
|
||||
// 0x00000002 - eGameSetting_GameSetting_Online - on
|
||||
// 0x00000004 - eGameSetting_GameSetting_Invite - off
|
||||
// 0x00000008 - eGameSetting_GameSetting_FriendsOfFriends - on
|
||||
// 0x00000010 - eGameSetting_PSVita_NetworkModeAdhoc - on
|
||||
|
||||
// TU 5
|
||||
// 0x00000030 - eGameSetting_DisplayUpdateMessage - 3 - counts down to zero
|
||||
// TU 6
|
||||
// 0x00000040 - eGameSetting_BedrockFog - off
|
||||
// 0x00000080 - eGameSetting_DisplayHUD - on
|
||||
// 0x00000100 - eGameSetting_DisplayHand - on
|
||||
// TU 7
|
||||
// 0x00000200 - eGameSetting_CustomSkinAnim - on
|
||||
|
||||
// TU9 // 0x00000400 - eGameSetting_DeathMessages - on
|
||||
|
||||
// Adding another bitmask to store "special" completion tasks for the tutorial
|
||||
unsigned int uiSpecialTutorialBitmask;
|
||||
|
||||
// A value that encodes the cape that the player has set
|
||||
DWORD dwSelectedCape;
|
||||
|
||||
unsigned int uiFavoriteSkinA[MAX_FAVORITE_SKINS];
|
||||
unsigned char ucCurrentFavoriteSkinPos;
|
||||
|
||||
// TU13
|
||||
unsigned int uiMashUpPackWorldsDisplay; // bitmask to enable/disable the display of the individual mash-up pack worlds
|
||||
|
||||
// PS3 1.05 - Adding Greek, so need a language
|
||||
unsigned char ucLanguage;
|
||||
// 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)];
|
||||
// 4J-PB - don't need to define the padded space, the union with ucReservedSpace will make the sizeof GAME_SETTINGS correct
|
||||
};
|
||||
|
||||
unsigned char ucReservedSpace[192];
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
GAME_SETTINGS;
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
typedef struct
|
||||
{
|
||||
WCHAR wchPlayerUID[64];
|
||||
char pszLevelName[14];
|
||||
}
|
||||
BANNEDLISTDATA,*PBANNEDLISTDATA;
|
||||
#else
|
||||
typedef struct
|
||||
{
|
||||
PlayerUID xuid;
|
||||
char pszLevelName[14];
|
||||
}
|
||||
BANNEDLISTDATA,*PBANNEDLISTDATA;
|
||||
#endif
|
||||
|
||||
typedef std::vector <PBANNEDLISTDATA> VBANNEDLIST;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int iPad;
|
||||
eXuiAction action;
|
||||
}
|
||||
XuiActionParam;
|
||||
|
||||
// tips
|
||||
typedef struct
|
||||
{
|
||||
int iSortValue;
|
||||
UINT uiStringID;
|
||||
}
|
||||
TIPSTRUCT;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
eXUID eXuid;
|
||||
WCHAR wchCape[MAX_CAPENAME_SIZE];
|
||||
WCHAR wchSkin[MAX_CAPENAME_SIZE];
|
||||
}
|
||||
MOJANG_DATA;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
eDLCContentType eDLCType;
|
||||
#if defined( __PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
char chImageURL[256];//SCE_NP_COMMERCE2_URL_LEN
|
||||
#else
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
|
||||
wstring wsProductId;
|
||||
wstring wsDisplayName;
|
||||
|
||||
// add a store for the local DLC image
|
||||
PBYTE pbImageData;
|
||||
DWORD dwImageBytes;
|
||||
#else
|
||||
ULONGLONG ullOfferID_Full;
|
||||
ULONGLONG ullOfferID_Trial;
|
||||
#endif
|
||||
WCHAR wchBanner[MAX_BANNERNAME_SIZE];
|
||||
WCHAR wchDataFile[MAX_BANNERNAME_SIZE];
|
||||
int iGender;
|
||||
#endif
|
||||
int iConfig;
|
||||
unsigned int uiSortIndex;
|
||||
}
|
||||
DLC_INFO;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x,z;
|
||||
_eTerrainFeatureType eTerrainFeature;
|
||||
}
|
||||
FEATURE_DATA;
|
||||
|
||||
// banned list
|
||||
typedef struct
|
||||
{
|
||||
BYTE *pBannedList;
|
||||
DWORD dwBytes;
|
||||
}
|
||||
BANNEDLIST;
|
||||
|
||||
typedef struct _DLCRequest
|
||||
{
|
||||
DWORD dwType;
|
||||
eDLCContentState eState;
|
||||
}
|
||||
DLCRequest;
|
||||
|
||||
typedef struct _TMSPPRequest
|
||||
{
|
||||
eTMSContentState eState;
|
||||
eDLCContentType eType;
|
||||
C4JStorage::eGlobalStorage eStorageFacility;
|
||||
C4JStorage::eTMS_FILETYPEVAL eFileTypeVal;
|
||||
//char szFilename[MAX_TMSFILENAME_SIZE];
|
||||
#ifdef _XBOX_ONE
|
||||
int( *CallbackFunc)(LPVOID,int,int,LPVOID, WCHAR *);
|
||||
#else
|
||||
int( *CallbackFunc)(LPVOID,int,int,C4JStorage::PTMSPP_FILEDATA, LPCSTR szFilename);
|
||||
#endif
|
||||
WCHAR wchFilename[MAX_TMSFILENAME_SIZE];
|
||||
|
||||
LPVOID lpCallbackParam;
|
||||
}
|
||||
TMSPPRequest;
|
||||
|
||||
typedef pair<EUIScene, HXUIOBJ> SceneStackPair;
|
||||
38
Minecraft.Client/Common/Audio/Consoles_SoundEngine.cpp
Normal file
38
Minecraft.Client/Common/Audio/Consoles_SoundEngine.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include "stdafx.h"
|
||||
#include "Consoles_SoundEngine.h"
|
||||
|
||||
|
||||
bool ConsoleSoundEngine::GetIsPlayingStreamingCDMusic()
|
||||
{
|
||||
return m_bIsPlayingStreamingCDMusic;
|
||||
}
|
||||
bool ConsoleSoundEngine::GetIsPlayingStreamingGameMusic()
|
||||
{
|
||||
return m_bIsPlayingStreamingGameMusic;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingStreamingCDMusic(bool bVal)
|
||||
{
|
||||
m_bIsPlayingStreamingCDMusic=bVal;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingStreamingGameMusic(bool bVal)
|
||||
{
|
||||
m_bIsPlayingStreamingGameMusic=bVal;
|
||||
}
|
||||
bool ConsoleSoundEngine::GetIsPlayingEndMusic()
|
||||
{
|
||||
return m_bIsPlayingEndMusic;
|
||||
}
|
||||
bool ConsoleSoundEngine::GetIsPlayingNetherMusic()
|
||||
{
|
||||
return m_bIsPlayingNetherMusic;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingEndMusic(bool bVal)
|
||||
{
|
||||
m_bIsPlayingEndMusic=bVal;
|
||||
}
|
||||
void ConsoleSoundEngine::SetIsPlayingNetherMusic(bool bVal)
|
||||
{
|
||||
m_bIsPlayingNetherMusic=bVal;
|
||||
}
|
||||
|
||||
|
||||
81
Minecraft.Client/Common/Audio/Consoles_SoundEngine.h
Normal file
81
Minecraft.Client/Common/Audio/Consoles_SoundEngine.h
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
#pragma once
|
||||
|
||||
#include "..\..\..\Minecraft.World\SoundTypes.h"
|
||||
|
||||
#ifdef _XBOX
|
||||
|
||||
#elif defined (__PS3__)
|
||||
#undef __in
|
||||
#undef __out
|
||||
#include "..\..\PS3\Miles\include\mss.h"
|
||||
#elif defined (__PSVITA__)
|
||||
#include "..\..\PSVITA\Miles\include\mss.h"
|
||||
#elif defined _DURANGO
|
||||
// 4J Stu - Temp define to get Miles to link, can likely be removed when we get a new version of Miles
|
||||
#define _SEKRIT
|
||||
#include "..\..\Durango\Miles\include\mss.h"
|
||||
#elif defined _WINDOWS64
|
||||
#include "..\..\windows64\Miles\include\mss.h"
|
||||
#else // PS4
|
||||
// 4J Stu - Temp define to get Miles to link, can likely be removed when we get a new version of Miles
|
||||
#define _SEKRIT2
|
||||
#include "..\..\Orbis\Miles\include\mss.h"
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x,y,z;
|
||||
}
|
||||
AUDIO_VECTOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool bValid;
|
||||
AUDIO_VECTOR vPosition;
|
||||
AUDIO_VECTOR vOrientFront;
|
||||
}
|
||||
AUDIO_LISTENER;
|
||||
|
||||
class Options;
|
||||
|
||||
class ConsoleSoundEngine
|
||||
{
|
||||
public:
|
||||
|
||||
ConsoleSoundEngine() : m_bIsPlayingStreamingCDMusic(false),m_bIsPlayingStreamingGameMusic(false), m_bIsPlayingEndMusic(false),m_bIsPlayingNetherMusic(false){};
|
||||
virtual void tick(shared_ptr<Mob> *players, float a) =0;
|
||||
virtual void destroy()=0;
|
||||
virtual void play(int iSound, float x, float y, float z, float volume, float pitch) =0;
|
||||
virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) =0;
|
||||
virtual void playUI(int iSound, float volume, float pitch) =0;
|
||||
virtual void updateMusicVolume(float fVal) =0;
|
||||
virtual void updateSystemMusicPlaying(bool isPlaying) = 0;
|
||||
virtual void updateSoundEffectVolume(float fVal) =0;
|
||||
virtual void init(Options *) =0 ;
|
||||
virtual void add(const wstring& name, File *file) =0;
|
||||
virtual void addMusic(const wstring& name, File *file) =0;
|
||||
virtual void addStreaming(const wstring& name, File *file) =0;
|
||||
virtual char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces) =0;
|
||||
virtual void playMusicTick() =0;
|
||||
|
||||
virtual bool GetIsPlayingStreamingCDMusic() ;
|
||||
virtual bool GetIsPlayingStreamingGameMusic() ;
|
||||
virtual void SetIsPlayingStreamingCDMusic(bool bVal) ;
|
||||
virtual void SetIsPlayingStreamingGameMusic(bool bVal) ;
|
||||
virtual bool GetIsPlayingEndMusic() ;
|
||||
virtual bool GetIsPlayingNetherMusic() ;
|
||||
virtual void SetIsPlayingEndMusic(bool bVal) ;
|
||||
virtual void SetIsPlayingNetherMusic(bool bVal) ;
|
||||
static const WCHAR *wchSoundNames[eSoundType_MAX];
|
||||
static const WCHAR *wchUISoundNames[eSFX_MAX];
|
||||
|
||||
private:
|
||||
// platform specific functions
|
||||
|
||||
virtual int initAudioHardware(int iMinSpeakers)=0;
|
||||
|
||||
bool m_bIsPlayingStreamingCDMusic;
|
||||
bool m_bIsPlayingStreamingGameMusic;
|
||||
bool m_bIsPlayingEndMusic;
|
||||
bool m_bIsPlayingNetherMusic;
|
||||
};
|
||||
1668
Minecraft.Client/Common/Audio/SoundEngine.cpp
Normal file
1668
Minecraft.Client/Common/Audio/SoundEngine.cpp
Normal file
File diff suppressed because it is too large
Load diff
168
Minecraft.Client/Common/Audio/SoundEngine.h
Normal file
168
Minecraft.Client/Common/Audio/SoundEngine.h
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
#pragma once
|
||||
class Mob;
|
||||
class Options;
|
||||
using namespace std;
|
||||
#include "..\..\Minecraft.World\SoundTypes.h"
|
||||
|
||||
enum eMUSICFILES
|
||||
{
|
||||
eStream_Overworld_Calm1 = 0,
|
||||
eStream_Overworld_Calm2,
|
||||
eStream_Overworld_Calm3,
|
||||
eStream_Overworld_hal1,
|
||||
eStream_Overworld_hal2,
|
||||
eStream_Overworld_hal3,
|
||||
eStream_Overworld_hal4,
|
||||
eStream_Overworld_nuance1,
|
||||
eStream_Overworld_nuance2,
|
||||
#ifndef _XBOX
|
||||
// Add the new music tracks
|
||||
eStream_Overworld_Creative1,
|
||||
eStream_Overworld_Creative2,
|
||||
eStream_Overworld_Creative3,
|
||||
eStream_Overworld_Creative4,
|
||||
eStream_Overworld_Creative5,
|
||||
eStream_Overworld_Creative6,
|
||||
eStream_Overworld_Menu1,
|
||||
eStream_Overworld_Menu2,
|
||||
eStream_Overworld_Menu3,
|
||||
eStream_Overworld_Menu4,
|
||||
#endif
|
||||
eStream_Overworld_piano1,
|
||||
eStream_Overworld_piano2,
|
||||
eStream_Overworld_piano3, // <-- make piano3 the last overworld one
|
||||
// Nether
|
||||
eStream_Nether1,
|
||||
eStream_Nether2,
|
||||
eStream_Nether3,
|
||||
eStream_Nether4,
|
||||
// The End
|
||||
eStream_end_dragon,
|
||||
eStream_end_end,
|
||||
eStream_CD_1,
|
||||
eStream_CD_2,
|
||||
eStream_CD_3,
|
||||
eStream_CD_4,
|
||||
eStream_CD_5,
|
||||
eStream_CD_6,
|
||||
eStream_CD_7,
|
||||
eStream_CD_8,
|
||||
eStream_CD_9,
|
||||
eStream_CD_10,
|
||||
eStream_CD_11,
|
||||
eStream_CD_12,
|
||||
eStream_Max,
|
||||
};
|
||||
|
||||
enum eMUSICTYPE
|
||||
{
|
||||
eMusicType_None,
|
||||
eMusicType_Game,
|
||||
eMusicType_CD,
|
||||
};
|
||||
|
||||
|
||||
enum MUSIC_STREAMSTATE
|
||||
{
|
||||
eMusicStreamState_Idle=0,
|
||||
eMusicStreamState_Stop,
|
||||
eMusicStreamState_Stopping,
|
||||
eMusicStreamState_Opening,
|
||||
eMusicStreamState_OpeningCancel,
|
||||
eMusicStreamState_Play,
|
||||
eMusicStreamState_Playing,
|
||||
eMusicStreamState_Completed
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
F32 x,y,z,volume,pitch;
|
||||
int iSound;
|
||||
bool bIs3D;
|
||||
bool bUseSoundsPitchVal;
|
||||
#ifdef _DEBUG
|
||||
char chName[64];
|
||||
#endif
|
||||
}
|
||||
AUDIO_INFO;
|
||||
|
||||
class SoundEngine : public ConsoleSoundEngine
|
||||
{
|
||||
static const int MAX_SAME_SOUNDS_PLAYING = 8; // 4J added
|
||||
public:
|
||||
SoundEngine();
|
||||
virtual void destroy();
|
||||
#ifdef _DEBUG
|
||||
void GetSoundName(char *szSoundName,int iSound);
|
||||
#endif
|
||||
virtual void play(int iSound, float x, float y, float z, float volume, float pitch);
|
||||
virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true);
|
||||
virtual void playUI(int iSound, float volume, float pitch);
|
||||
virtual void playMusicTick();
|
||||
virtual void updateMusicVolume(float fVal);
|
||||
virtual void updateSystemMusicPlaying(bool isPlaying);
|
||||
virtual void updateSoundEffectVolume(float fVal);
|
||||
virtual void init(Options *);
|
||||
virtual void tick(shared_ptr<Mob> *players, float a); // 4J - updated to take array of local players rather than single one
|
||||
virtual void add(const wstring& name, File *file);
|
||||
virtual void addMusic(const wstring& name, File *file);
|
||||
virtual void addStreaming(const wstring& name, File *file);
|
||||
virtual char *ConvertSoundPathToName(const wstring& name, bool bConvertSpaces=false);
|
||||
bool isStreamingWavebankReady(); // 4J Added
|
||||
int getMusicID(int iDomain);
|
||||
int getMusicID(const wstring& name);
|
||||
void SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1);
|
||||
void updateMiles(); // AP added so Vita can update all the Miles functions during the mixer callback
|
||||
void playMusicUpdate();
|
||||
|
||||
private:
|
||||
float getMasterMusicVolume();
|
||||
// platform specific functions
|
||||
#ifdef __PS3__
|
||||
int initAudioHardware(int iMinSpeakers);
|
||||
#else
|
||||
int initAudioHardware(int iMinSpeakers) { return iMinSpeakers;}
|
||||
#endif
|
||||
|
||||
int GetRandomishTrack(int iStart,int iEnd);
|
||||
|
||||
HMSOUNDBANK m_hBank;
|
||||
HDIGDRIVER m_hDriver;
|
||||
HSTREAM m_hStream;
|
||||
|
||||
static char m_szSoundPath[];
|
||||
static char m_szMusicPath[];
|
||||
static char m_szRedistName[];
|
||||
static char *m_szStreamFileA[eStream_Max];
|
||||
|
||||
AUDIO_LISTENER m_ListenerA[MAX_LOCAL_PLAYERS];
|
||||
int m_validListenerCount;
|
||||
|
||||
|
||||
Random *random;
|
||||
int m_musicID;
|
||||
int m_iMusicDelay;
|
||||
int m_StreamState;
|
||||
int m_MusicType;
|
||||
AUDIO_INFO m_StreamingAudioInfo;
|
||||
wstring m_CDMusic;
|
||||
BOOL m_bSystemMusicPlaying;
|
||||
float m_MasterMusicVolume;
|
||||
float m_MasterEffectsVolume;
|
||||
|
||||
C4JThread *m_openStreamThread;
|
||||
static int OpenStreamThreadProc( void* lpParameter );
|
||||
char m_szStreamName[255];
|
||||
int CurrentSoundsPlaying[eSoundType_MAX+eSFX_MAX];
|
||||
|
||||
// streaming music files - will be different for mash-up packs
|
||||
int m_iStream_Overworld_Min,m_iStream_Overworld_Max;
|
||||
int m_iStream_Nether_Min,m_iStream_Nether_Max;
|
||||
int m_iStream_End_Min,m_iStream_End_Max;
|
||||
int m_iStream_CD_1;
|
||||
bool *m_bHeardTrackA;
|
||||
|
||||
#ifdef __ORBIS__
|
||||
int32_t m_hBGMAudio;
|
||||
#endif
|
||||
};
|
||||
165
Minecraft.Client/Common/Audio/SoundNames.cpp
Normal file
165
Minecraft.Client/Common/Audio/SoundNames.cpp
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
#include "Consoles_SoundEngine.h"
|
||||
|
||||
|
||||
|
||||
const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
|
||||
{
|
||||
L"mob.chicken", // eSoundType_MOB_CHICKEN_AMBIENT
|
||||
L"mob.chickenhurt", // eSoundType_MOB_CHICKEN_HURT
|
||||
L"mob.chickenplop", // eSoundType_MOB_CHICKENPLOP
|
||||
L"mob.cow", // eSoundType_MOB_COW_AMBIENT
|
||||
L"mob.cowhurt", // eSoundType_MOB_COW_HURT
|
||||
L"mob.pig", // eSoundType_MOB_PIG_AMBIENT
|
||||
L"mob.pigdeath", // eSoundType_MOB_PIG_DEATH
|
||||
L"mob.sheep", // eSoundType_MOB_SHEEP_AMBIENT
|
||||
L"mob.wolf.growl", // eSoundType_MOB_WOLF_GROWL
|
||||
L"mob.wolf.whine", // eSoundType_MOB_WOLF_WHINE
|
||||
L"mob.wolf.panting", // eSoundType_MOB_WOLF_PANTING
|
||||
L"mob.wolf.bark", // eSoundType_MOB_WOLF_BARK
|
||||
L"mob.wolf.hurt", // eSoundType_MOB_WOLF_HURT
|
||||
L"mob.wolf.death", // eSoundType_MOB_WOLF_DEATH
|
||||
L"mob.wolf.shake", // eSoundType_MOB_WOLF_SHAKE
|
||||
L"mob.blaze.breathe", // eSoundType_MOB_BLAZE_BREATHE
|
||||
L"mob.blaze.hit", // eSoundType_MOB_BLAZE_HURT
|
||||
L"mob.blaze.death", // eSoundType_MOB_BLAZE_DEATH
|
||||
L"mob.ghast.moan", // eSoundType_MOB_GHAST_MOAN
|
||||
L"mob.ghast.scream", // eSoundType_MOB_GHAST_SCREAM
|
||||
L"mob.ghast.death", // eSoundType_MOB_GHAST_DEATH
|
||||
L"mob.ghast.fireball", // eSoundType_MOB_GHAST_FIREBALL
|
||||
L"mob.ghast.charge", // eSoundType_MOB_GHAST_CHARGE
|
||||
L"mob.endermen.idle", // eSoundType_MOB_ENDERMEN_IDLE
|
||||
L"mob.endermen.hit", // eSoundType_MOB_ENDERMEN_HIT
|
||||
L"mob.endermen.death", // eSoundType_MOB_ENDERMEN_DEATH
|
||||
L"mob.endermen.portal", // eSoundType_MOB_ENDERMEN_PORTAL
|
||||
L"mob.zombiepig.zpig", // eSoundType_MOB_ZOMBIEPIG_AMBIENT
|
||||
L"mob.zombiepig.zpighurt", // eSoundType_MOB_ZOMBIEPIG_HURT
|
||||
L"mob.zombiepig.zpigdeath", // eSoundType_MOB_ZOMBIEPIG_DEATH
|
||||
L"mob.zombiepig.zpigangry", // eSoundType_MOB_ZOMBIEPIG_ZPIGANGRY
|
||||
L"mob.silverfish.say", // eSoundType_MOB_SILVERFISH_AMBIENT,
|
||||
L"mob.silverfish.hit", // eSoundType_MOB_SILVERFISH_HURT
|
||||
L"mob.silverfish.kill", // eSoundType_MOB_SILVERFISH_DEATH,
|
||||
L"mob.silverfish.step", // eSoundType_MOB_SILVERFISH_STEP,
|
||||
L"mob.skeleton", // eSoundType_MOB_SKELETON_AMBIENT,
|
||||
L"mob.skeletonhurt", // eSoundType_MOB_SKELETON_HURT,
|
||||
L"mob.spider", // eSoundType_MOB_SPIDER_AMBIENT,
|
||||
L"mob.spiderdeath", // eSoundType_MOB_SPIDER_DEATH,
|
||||
L"mob.slime", // eSoundType_MOB_SLIME,
|
||||
L"mob.slimeattack", // eSoundType_MOB_SLIME_ATTACK,
|
||||
L"mob.creeper", // eSoundType_MOB_CREEPER_HURT,
|
||||
L"mob.creeperdeath", // eSoundType_MOB_CREEPER_DEATH,
|
||||
L"mob.zombie", // eSoundType_MOB_ZOMBIE_AMBIENT,
|
||||
L"mob.zombiehurt", // eSoundType_MOB_ZOMBIE_HURT,
|
||||
L"mob.zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH,
|
||||
L"mob.zombie.wood", // eSoundType_MOB_ZOMBIE_WOOD,
|
||||
L"mob.zombie.woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK,
|
||||
L"mob.zombie.metal", // eSoundType_MOB_ZOMBIE_METAL,
|
||||
L"mob.magmacube.big", // eSoundType_MOB_MAGMACUBE_BIG,
|
||||
L"mob.magmacube.small", // eSoundType_MOB_MAGMACUBE_SMALL,
|
||||
L"mob.cat.purr", // eSoundType_MOB_CAT_PURR
|
||||
L"mob.cat.purreow", // eSoundType_MOB_CAT_PURREOW
|
||||
L"mob.cat.meow", // eSoundType_MOB_CAT_MEOW
|
||||
// 4J-PB - correct the name of the event for hitting ocelots
|
||||
L"mob.cat.hit", // eSoundType_MOB_CAT_HITT
|
||||
// L"mob.irongolem.throw", // eSoundType_MOB_IRONGOLEM_THROW
|
||||
// L"mob.irongolem.hit", // eSoundType_MOB_IRONGOLEM_HIT
|
||||
// L"mob.irongolem.death", // eSoundType_MOB_IRONGOLEM_DEATH
|
||||
// L"mob.irongolem.walk", // eSoundType_MOB_IRONGOLEM_WALK
|
||||
L"random.bow", // eSoundType_RANDOM_BOW,
|
||||
L"random.bowhit", // eSoundType_RANDOM_BOW_HIT,
|
||||
L"random.explode", // eSoundType_RANDOM_EXPLODE,
|
||||
L"random.fizz", // eSoundType_RANDOM_FIZZ,
|
||||
L"random.pop", // eSoundType_RANDOM_POP,
|
||||
L"random.fuse", // eSoundType_RANDOM_FUSE,
|
||||
L"random.drink", // eSoundType_RANDOM_DRINK,
|
||||
L"random.eat", // eSoundType_RANDOM_EAT,
|
||||
L"random.burp", // eSoundType_RANDOM_BURP,
|
||||
L"random.splash", // eSoundType_RANDOM_SPLASH,
|
||||
L"random.click", // eSoundType_RANDOM_CLICK,
|
||||
L"random.glass", // eSoundType_RANDOM_GLASS,
|
||||
L"random.orb", // eSoundType_RANDOM_ORB,
|
||||
L"random.break", // eSoundType_RANDOM_BREAK,
|
||||
L"random.chestopen", // eSoundType_RANDOM_CHEST_OPEN,
|
||||
L"random.chestclosed", // eSoundType_RANDOM_CHEST_CLOSE,
|
||||
L"random.door_open", // eSoundType_RANDOM_DOOR_OPEN,
|
||||
L"random.door_close", // eSoundType_RANDOM_DOOR_CLOSE,
|
||||
L"ambient.weather.rain", // eSoundType_AMBIENT_WEATHER_RAIN,
|
||||
L"ambient.weather.thunder", // eSoundType_AMBIENT_WEATHER_THUNDER,
|
||||
L"ambient.cave.cave", // eSoundType_CAVE_CAVE, DON'T USE FOR XBOX 360!!!
|
||||
#ifdef _XBOX
|
||||
L"ambient.cave.cave2", // eSoundType_CAVE_CAVE2 - removed the two sounds that were at 192k in the first ambient cave event
|
||||
#endif
|
||||
L"portal.portal", // eSoundType_PORTAL_PORTAL,
|
||||
// 4J-PB - added a couple that were still using wstring
|
||||
L"portal.trigger", // eSoundType_PORTAL_TRIGGER
|
||||
L"portal.travel", // eSoundType_PORTAL_TRAVEL
|
||||
|
||||
L"fire.ignite", // eSoundType_FIRE_IGNITE,
|
||||
L"fire.fire", // eSoundType_FIRE_FIRE,
|
||||
L"damage.hurtflesh", // eSoundType_DAMAGE_HURT,
|
||||
L"damage.fallsmall", // eSoundType_DAMAGE_FALL_SMALL,
|
||||
L"damage.fallbig", // eSoundType_DAMAGE_FALL_BIG,
|
||||
L"note.harp", // eSoundType_NOTE_HARP,
|
||||
L"note.bd", // eSoundType_NOTE_BD,
|
||||
L"note.snare", // eSoundType_NOTE_SNARE,
|
||||
L"note.hat", // eSoundType_NOTE_HAT,
|
||||
L"note.bassattack", // eSoundType_NOTE_BASSATTACK,
|
||||
L"tile.piston.in", // eSoundType_TILE_PISTON_IN,
|
||||
L"tile.piston.out", // eSoundType_TILE_PISTON_OUT,
|
||||
L"liquid.water", // eSoundType_LIQUID_WATER,
|
||||
L"liquid.lavapop", // eSoundType_LIQUID_LAVA_POP,
|
||||
L"liquid.lava", // eSoundType_LIQUID_LAVA,
|
||||
L"step.stone", // eSoundType_STEP_STONE,
|
||||
L"step.wood", // eSoundType_STEP_WOOD,
|
||||
L"step.gravel", // eSoundType_STEP_GRAVEL,
|
||||
L"step.grass", // eSoundType_STEP_GRASS,
|
||||
L"step.metal", // eSoundType_STEP_METAL,
|
||||
L"step.cloth", // eSoundType_STEP_CLOTH,
|
||||
L"step.sand", // eSoundType_STEP_SAND,
|
||||
|
||||
// below this are the additional sounds from the second soundbank
|
||||
L"mob.enderdragon.end", // eSoundType_MOB_ENDERDRAGON_END
|
||||
L"mob.enderdragon.growl", // eSoundType_MOB_ENDERDRAGON_GROWL
|
||||
L"mob.enderdragon.hit", // eSoundType_MOB_ENDERDRAGON_HIT
|
||||
L"mob.enderdragon.wings", // eSoundType_MOB_ENDERDRAGON_MOVE
|
||||
L"mob.irongolem.throw", // eSoundType_MOB_IRONGOLEM_THROW
|
||||
L"mob.irongolem.hit", // eSoundType_MOB_IRONGOLEM_HIT
|
||||
L"mob.irongolem.death", // eSoundType_MOB_IRONGOLEM_DEATH
|
||||
L"mob.irongolem.walk", // eSoundType_MOB_IRONGOLEM_WALK
|
||||
|
||||
// TU14
|
||||
L"damage.thorns", // eSoundType_DAMAGE_THORNS
|
||||
L"random.anvil_break", // eSoundType_RANDOM_ANVIL_BREAK
|
||||
L"random.anvil_land", // eSoundType_RANDOM_ANVIL_LAND
|
||||
L"random.anvil_use", // eSoundType_RANDOM_ANVIL_USE
|
||||
L"mob.villager.haggle", // eSoundType_MOB_VILLAGER_HAGGLE
|
||||
L"mob.villager.idle", // eSoundType_MOB_VILLAGER_IDLE
|
||||
L"mob.villager.hit", // eSoundType_MOB_VILLAGER_HIT
|
||||
L"mob.villager.death", // eSoundType_MOB_VILLAGER_DEATH
|
||||
L"mob.villager.yes", // eSoundType_MOB_VILLAGER_YES
|
||||
L"mob.villager.no", // eSoundType_MOB_VILLAGER_NO
|
||||
L"mob.zombie.infect", // eSoundType_MOB_ZOMBIE_INFECT
|
||||
L"mob.zombie.unfect", // eSoundType_MOB_ZOMBIE_UNFECT
|
||||
L"mob.zombie.remedy", // eSoundType_MOB_ZOMBIE_REMEDY
|
||||
L"step.snow", // eSoundType_STEP_SNOW
|
||||
L"step.ladder", // eSoundType_STEP_LADDER
|
||||
L"dig.cloth", // eSoundType_DIG_CLOTH
|
||||
L"dig.grass", // eSoundType_DIG_GRASS
|
||||
L"dig.gravel", // eSoundType_DIG_GRAVEL
|
||||
L"dig.sand", // eSoundType_DIG_SAND
|
||||
L"dig.snow", // eSoundType_DIG_SNOW
|
||||
L"dig.stone", // eSoundType_DIG_STONE
|
||||
L"dig.wood", // eSoundType_DIG_WOOD
|
||||
};
|
||||
|
||||
|
||||
const WCHAR *ConsoleSoundEngine::wchUISoundNames[eSFX_MAX]=
|
||||
{
|
||||
L"back",
|
||||
L"craft",
|
||||
L"craftfail",
|
||||
L"focus",
|
||||
L"press",
|
||||
L"scroll",
|
||||
};
|
||||
57
Minecraft.Client/Common/BuildVer.h
Normal file
57
Minecraft.Client/Common/BuildVer.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
|
||||
#define VER_PRODUCTMAJORVERSION 0
|
||||
#define VER_PRODUCTMINORVERSION 0
|
||||
|
||||
// This goes up with each build
|
||||
// 4J-JEV: This value is extracted with a regex so it can be placed as the version in the AppX manifest on Durango.
|
||||
#define VER_PRODUCTBUILD 495
|
||||
// This goes up if there is any change to network traffic or code in a build
|
||||
#define VER_NETWORK 495
|
||||
#define VER_PRODUCTBUILD_QFE 0
|
||||
|
||||
#define VER_FILEVERSION_STRING "1.3"
|
||||
#define VER_PRODUCTVERSION_STRING VER_FILEVERSION_STRING
|
||||
#define VER_FILEVERSION_STRING_W L"1.3"
|
||||
#define VER_PRODUCTVERSION_STRING_W VER_FILEVERSION_STRING_W
|
||||
#define VER_FILEBETA_STR ""
|
||||
#undef VER_FILEVERSION
|
||||
#define VER_FILEVERSION VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE
|
||||
#define VER_PRODUCTVERSION VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION, VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE
|
||||
|
||||
#if (VER_PRODUCTBUILD < 10)
|
||||
#define VER_FILEBPAD "000"
|
||||
#define VER_FILEBPAD_W L"000"
|
||||
#elif (VER_PRODUCTBUILD < 100)
|
||||
#define VER_FILEBPAD "00"
|
||||
#define VER_FILEBPAD_W L"00"
|
||||
#elif (VER_PRODUCTBUILD < 1000)
|
||||
#define VER_FILEBPAD "0"
|
||||
#define VER_FILEBPAD_W L"0"
|
||||
#else
|
||||
#define VER_FILEBPAD
|
||||
#define VER_FILEBPAD_W
|
||||
#endif
|
||||
|
||||
#define VER_WIDE_PREFIX(x) L##x
|
||||
|
||||
#define VER_FILEVERSION_STR2(x,y) VER_FILEVERSION_STRING "." VER_FILEBPAD #x "." #y
|
||||
#define VER_FILEVERSION_STR2_W(x,y) VER_FILEVERSION_STRING_W L"." VER_FILEBPAD_W VER_WIDE_PREFIX(#x) L"." VER_WIDE_PREFIX(#y)
|
||||
#define VER_FILEVERSION_STR1(x,y) VER_FILEVERSION_STR2(x, y)
|
||||
#define VER_FILEVERSION_STR1_W(x,y) VER_FILEVERSION_STR2_W(x, y)
|
||||
|
||||
#undef VER_FILEVERSION_STR
|
||||
#define VER_FILEVERSION_STR VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
|
||||
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
|
||||
|
||||
#define VER_FILEVERSION_STR_W VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
|
||||
#define VER_PRODUCTVERSION_STR_W VER_FILEVERSION_STR1_W(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)
|
||||
|
||||
#if (VER_PRODUCTBUILD_QFE >= 256)
|
||||
#error "QFE number cannot exceed 255"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
176
Minecraft.Client/Common/C4JMemoryPool.h
Normal file
176
Minecraft.Client/Common/C4JMemoryPool.h
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
class C4JMemoryPool
|
||||
{
|
||||
public:
|
||||
unsigned int Align(unsigned int val, unsigned int align) { return int((val+(align-1))/align) * align; }
|
||||
virtual void* Alloc(size_t size) = 0;
|
||||
virtual void Free(void* ptr) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Fast Efficient Fixed-Size Memory Pool : No Loops and No Overhead
|
||||
// http://www.alogicalmind.com/memory_pools/index.htm
|
||||
class C4JMemoryPoolFixed : public C4JMemoryPool
|
||||
{
|
||||
// Basic type define
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned char uchar;
|
||||
uint m_numOfBlocks; // Num of blocks
|
||||
uint m_sizeOfEachBlock; // Size of each block
|
||||
uint m_numFreeBlocks; // Num of remaining blocks
|
||||
uint m_numInitialized; // Num of initialized blocks
|
||||
uchar* m_memStart; // Beginning of memory pool
|
||||
uchar* m_memEnd; // End of memory pool
|
||||
uchar* m_next; // Num of next free block
|
||||
// CRITICAL_SECTION m_CS;
|
||||
public:
|
||||
C4JMemoryPoolFixed()
|
||||
{
|
||||
m_numOfBlocks = 0;
|
||||
m_sizeOfEachBlock = 0;
|
||||
m_numFreeBlocks = 0;
|
||||
m_numInitialized = 0;
|
||||
m_memStart = NULL;
|
||||
m_memEnd = NULL;
|
||||
m_next = 0;
|
||||
}
|
||||
|
||||
C4JMemoryPoolFixed(uint sizeOfEachBlock, uint numOfBlocks)
|
||||
{
|
||||
CreatePool(sizeOfEachBlock, numOfBlocks);
|
||||
}
|
||||
|
||||
~C4JMemoryPoolFixed() { DestroyPool(); }
|
||||
|
||||
void CreatePool(uint sizeOfEachBlock, uint numOfBlocks)
|
||||
{
|
||||
assert(sizeOfEachBlock >= 4); // has to be at least the size of an int, for book keeping
|
||||
m_numOfBlocks = numOfBlocks;
|
||||
m_sizeOfEachBlock = sizeOfEachBlock;
|
||||
m_numFreeBlocks = numOfBlocks;
|
||||
m_numInitialized = 0;
|
||||
m_memStart = new uchar[ m_sizeOfEachBlock *
|
||||
m_numOfBlocks ];
|
||||
m_memEnd = m_memStart + (m_sizeOfEachBlock * m_numOfBlocks);
|
||||
m_next = m_memStart;
|
||||
// InitializeCriticalSection(&m_CS);
|
||||
}
|
||||
|
||||
void DestroyPool()
|
||||
{
|
||||
delete[] m_memStart;
|
||||
m_memStart = NULL;
|
||||
}
|
||||
|
||||
uchar* AddrFromIndex(uint i) const
|
||||
{
|
||||
return m_memStart + ( i * m_sizeOfEachBlock );
|
||||
}
|
||||
|
||||
uint IndexFromAddr(const uchar* p) const
|
||||
{
|
||||
return (((uint)(p - m_memStart)) / m_sizeOfEachBlock);
|
||||
}
|
||||
|
||||
virtual void* Alloc(size_t size)
|
||||
{
|
||||
if(size > m_sizeOfEachBlock)
|
||||
return ::malloc(size);
|
||||
// EnterCriticalSection(&m_CS);
|
||||
if (m_numInitialized < m_numOfBlocks )
|
||||
{
|
||||
uint* p = (uint*)AddrFromIndex( m_numInitialized );
|
||||
*p = m_numInitialized + 1;
|
||||
m_numInitialized++;
|
||||
}
|
||||
void* ret = NULL;
|
||||
if ( m_numFreeBlocks > 0 )
|
||||
{
|
||||
ret = (void*)m_next;
|
||||
--m_numFreeBlocks;
|
||||
if (m_numFreeBlocks!=0)
|
||||
{
|
||||
m_next = AddrFromIndex( *((uint*)m_next) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_next = NULL;
|
||||
}
|
||||
}
|
||||
// LeaveCriticalSection(&m_CS);
|
||||
return ret;
|
||||
}
|
||||
|
||||
virtual void Free(void* ptr)
|
||||
{
|
||||
if(ptr < m_memStart || ptr > m_memEnd)
|
||||
{
|
||||
::free(ptr);
|
||||
return;
|
||||
}
|
||||
// EnterCriticalSection(&m_CS);
|
||||
if (m_next != NULL)
|
||||
{
|
||||
(*(uint*)ptr) = IndexFromAddr( m_next );
|
||||
m_next = (uchar*)ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
*((uint*)ptr) = m_numOfBlocks;
|
||||
m_next = (uchar*)ptr;
|
||||
}
|
||||
++m_numFreeBlocks;
|
||||
// LeaveCriticalSection(&m_CS);
|
||||
}
|
||||
}; // End pool class
|
||||
|
||||
|
||||
// this pool will constantly grow until it is reset (automatically when all allocs have been "freed")
|
||||
class C4JMemoryPoolGrow : public C4JMemoryPool
|
||||
{
|
||||
uint32_t m_totalSize;
|
||||
uint32_t m_memUsed;
|
||||
uint32_t m_numAllocations;
|
||||
uint8_t* m_pMemory;
|
||||
uint32_t m_currentOffset;
|
||||
|
||||
public:
|
||||
C4JMemoryPoolGrow(uint32_t size = 64*1024)
|
||||
{
|
||||
size = Align(size, 4);
|
||||
m_totalSize = size;
|
||||
m_pMemory = new uint8_t[size];
|
||||
m_currentOffset = 0;
|
||||
m_memUsed = 0;
|
||||
m_numAllocations = 0;
|
||||
}
|
||||
|
||||
virtual void* Alloc(size_t size)
|
||||
{
|
||||
size = Align(size, 4); // 4 byte align the memory
|
||||
assert((m_currentOffset + size) < m_totalSize); // make sure we haven't ran out of space
|
||||
void* returnMem = &m_pMemory[m_currentOffset]; // grab the return memory
|
||||
m_currentOffset += size;
|
||||
m_numAllocations++;
|
||||
return returnMem;
|
||||
}
|
||||
virtual void Free(void* ptr)
|
||||
{
|
||||
m_numAllocations--;
|
||||
if(m_numAllocations == 0)
|
||||
m_currentOffset = 0; // reset the pool when we reach zero allocations
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
113
Minecraft.Client/Common/C4JMemoryPoolAllocator.h
Normal file
113
Minecraft.Client/Common/C4JMemoryPoolAllocator.h
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
|
||||
|
||||
#pragma once
|
||||
#include "..\Minecraft.Client\Common\C4JMemoryPool.h"
|
||||
|
||||
// Custom allocator, takes a C4JMemoryPool class, which can be one of a number of pool implementations.
|
||||
|
||||
template <class T>
|
||||
class C4JPoolAllocator
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
|
||||
//! A struct to construct an allocator for a different type.
|
||||
template<typename U>
|
||||
struct rebind { typedef C4JPoolAllocator<U> other; };
|
||||
|
||||
|
||||
C4JMemoryPool* m_pPool;
|
||||
bool m_selfAllocated;
|
||||
|
||||
C4JPoolAllocator( C4JMemoryPool* pool = new C4JMemoryPoolFixed(32, 4096 )) : m_pPool( pool ), m_selfAllocated(true)
|
||||
{
|
||||
printf("allocated mempool\n");
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
C4JPoolAllocator(C4JPoolAllocator<U> const& obj) : m_pPool( obj.m_pPool ), m_selfAllocated(false) // copy constructor
|
||||
{
|
||||
printf("C4JPoolAllocator constructed from 0x%08x\n", &obj);
|
||||
assert(obj.m_pPool);
|
||||
}
|
||||
private:
|
||||
|
||||
public:
|
||||
|
||||
~C4JPoolAllocator()
|
||||
{
|
||||
if(m_selfAllocated)
|
||||
delete m_pPool;
|
||||
}
|
||||
|
||||
pointer address( reference r ) const { return &r; }
|
||||
const_pointer address( const_reference r ) const { return &r; }
|
||||
|
||||
pointer allocate( size_type n, const void* /*hint*/=0 )
|
||||
{
|
||||
assert(m_pPool);
|
||||
return (pointer)m_pPool->Alloc(n * sizeof(T));
|
||||
}
|
||||
|
||||
void deallocate( pointer p, size_type /*n*/ )
|
||||
{
|
||||
assert(m_pPool);
|
||||
m_pPool->Free(p);
|
||||
}
|
||||
|
||||
void construct( pointer p, const T& val )
|
||||
{
|
||||
new (p) T(val);
|
||||
}
|
||||
|
||||
void destroy( pointer p )
|
||||
{
|
||||
p->~T();
|
||||
}
|
||||
|
||||
size_type max_size() const
|
||||
{
|
||||
return ULONG_MAX / sizeof(T);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
operator==( const C4JPoolAllocator<T>& left, const C4JPoolAllocator<T>& right )
|
||||
{
|
||||
if (left.m_pPool == right.m_pPool)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool
|
||||
operator!=( const C4JPoolAllocator<T>& left, const C4JPoolAllocator<T>& right)
|
||||
{
|
||||
if (left.m_pPool != right.m_pPool)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
366
Minecraft.Client/Common/Colours/ColourTable.cpp
Normal file
366
Minecraft.Client/Common/Colours/ColourTable.cpp
Normal file
|
|
@ -0,0 +1,366 @@
|
|||
#include "stdafx.h"
|
||||
#include "ColourTable.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
|
||||
unordered_map<wstring,eMinecraftColour> ColourTable::s_colourNamesMap;
|
||||
|
||||
wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] =
|
||||
{
|
||||
L"NOTSET",
|
||||
|
||||
L"Foliage_Evergreen",
|
||||
L"Foliage_Birch",
|
||||
L"Foliage_Default",
|
||||
L"Foliage_Common",
|
||||
L"Foliage_Ocean",
|
||||
L"Foliage_Plains",
|
||||
L"Foliage_Desert",
|
||||
L"Foliage_ExtremeHills",
|
||||
L"Foliage_Forest",
|
||||
L"Foliage_Taiga",
|
||||
L"Foliage_Swampland",
|
||||
L"Foliage_River",
|
||||
L"Foliage_Hell",
|
||||
L"Foliage_Sky",
|
||||
L"Foliage_FrozenOcean",
|
||||
L"Foliage_FrozenRiver",
|
||||
L"Foliage_IcePlains",
|
||||
L"Foliage_IceMountains",
|
||||
L"Foliage_MushroomIsland",
|
||||
L"Foliage_MushroomIslandShore",
|
||||
L"Foliage_Beach",
|
||||
L"Foliage_DesertHills",
|
||||
L"Foliage_ForestHills",
|
||||
L"Foliage_TaigaHills",
|
||||
L"Foliage_ExtremeHillsEdge",
|
||||
L"Foliage_Jungle",
|
||||
L"Foliage_JungleHills",
|
||||
|
||||
L"Grass_Common",
|
||||
L"Grass_Ocean",
|
||||
L"Grass_Plains",
|
||||
L"Grass_Desert",
|
||||
L"Grass_ExtremeHills",
|
||||
L"Grass_Forest",
|
||||
L"Grass_Taiga",
|
||||
L"Grass_Swampland",
|
||||
L"Grass_River",
|
||||
L"Grass_Hell",
|
||||
L"Grass_Sky",
|
||||
L"Grass_FrozenOcean",
|
||||
L"Grass_FrozenRiver",
|
||||
L"Grass_IcePlains",
|
||||
L"Grass_IceMountains",
|
||||
L"Grass_MushroomIsland",
|
||||
L"Grass_MushroomIslandShore",
|
||||
L"Grass_Beach",
|
||||
L"Grass_DesertHills",
|
||||
L"Grass_ForestHills",
|
||||
L"Grass_TaigaHills",
|
||||
L"Grass_ExtremeHillsEdge",
|
||||
L"Grass_Jungle",
|
||||
L"Grass_JungleHills",
|
||||
|
||||
L"Water_Ocean",
|
||||
L"Water_Plains",
|
||||
L"Water_Desert",
|
||||
L"Water_ExtremeHills",
|
||||
L"Water_Forest",
|
||||
L"Water_Taiga",
|
||||
L"Water_Swampland",
|
||||
L"Water_River",
|
||||
L"Water_Hell",
|
||||
L"Water_Sky",
|
||||
L"Water_FrozenOcean",
|
||||
L"Water_FrozenRiver",
|
||||
L"Water_IcePlains",
|
||||
L"Water_IceMountains",
|
||||
L"Water_MushroomIsland",
|
||||
L"Water_MushroomIslandShore",
|
||||
L"Water_Beach",
|
||||
L"Water_DesertHills",
|
||||
L"Water_ForestHills",
|
||||
L"Water_TaigaHills",
|
||||
L"Water_ExtremeHillsEdge",
|
||||
L"Water_Jungle",
|
||||
L"Water_JungleHills",
|
||||
|
||||
L"Sky_Ocean",
|
||||
L"Sky_Plains",
|
||||
L"Sky_Desert",
|
||||
L"Sky_ExtremeHills",
|
||||
L"Sky_Forest",
|
||||
L"Sky_Taiga",
|
||||
L"Sky_Swampland",
|
||||
L"Sky_River",
|
||||
L"Sky_Hell",
|
||||
L"Sky_Sky",
|
||||
L"Sky_FrozenOcean",
|
||||
L"Sky_FrozenRiver",
|
||||
L"Sky_IcePlains",
|
||||
L"Sky_IceMountains",
|
||||
L"Sky_MushroomIsland",
|
||||
L"Sky_MushroomIslandShore",
|
||||
L"Sky_Beach",
|
||||
L"Sky_DesertHills",
|
||||
L"Sky_ForestHills",
|
||||
L"Sky_TaigaHills",
|
||||
L"Sky_ExtremeHillsEdge",
|
||||
L"Sky_Jungle",
|
||||
L"Sky_JungleHills",
|
||||
|
||||
L"Tile_RedstoneDust",
|
||||
L"Tile_RedstoneDustUnlit",
|
||||
L"Tile_RedstoneDustLitMin",
|
||||
L"Tile_RedstoneDustLitMax",
|
||||
L"Tile_StemMin",
|
||||
L"Tile_StemMax",
|
||||
L"Tile_WaterLily",
|
||||
|
||||
L"Sky_Dawn_Dark",
|
||||
L"Sky_Dawn_Bright",
|
||||
|
||||
L"Material_None",
|
||||
L"Material_Grass",
|
||||
L"Material_Sand",
|
||||
L"Material_Cloth",
|
||||
L"Material_Fire",
|
||||
L"Material_Ice",
|
||||
L"Material_Metal",
|
||||
L"Material_Plant",
|
||||
L"Material_Snow",
|
||||
L"Material_Clay",
|
||||
L"Material_Dirt",
|
||||
L"Material_Stone",
|
||||
L"Material_Water",
|
||||
L"Material_Wood",
|
||||
L"Material_Emerald",
|
||||
|
||||
L"Particle_Note_00",
|
||||
L"Particle_Note_01",
|
||||
L"Particle_Note_02",
|
||||
L"Particle_Note_03",
|
||||
L"Particle_Note_04",
|
||||
L"Particle_Note_05",
|
||||
L"Particle_Note_06",
|
||||
L"Particle_Note_07",
|
||||
L"Particle_Note_08",
|
||||
L"Particle_Note_09",
|
||||
L"Particle_Note_10",
|
||||
L"Particle_Note_11",
|
||||
L"Particle_Note_12",
|
||||
L"Particle_Note_13",
|
||||
L"Particle_Note_14",
|
||||
L"Particle_Note_15",
|
||||
L"Particle_Note_16",
|
||||
L"Particle_Note_17",
|
||||
L"Particle_Note_18",
|
||||
L"Particle_Note_19",
|
||||
L"Particle_Note_20",
|
||||
L"Particle_Note_21",
|
||||
L"Particle_Note_22",
|
||||
L"Particle_Note_23",
|
||||
L"Particle_Note_24",
|
||||
|
||||
L"Particle_NetherPortal",
|
||||
L"Particle_EnderPortal",
|
||||
L"Particle_Smoke",
|
||||
L"Particle_Ender",
|
||||
|
||||
L"Particle_Explode",
|
||||
L"Particle_HugeExplosion",
|
||||
|
||||
L"Particle_DripWater",
|
||||
L"Particle_DripLavaStart",
|
||||
L"Particle_DripLavaEnd",
|
||||
|
||||
L"Particle_EnchantmentTable",
|
||||
L"Particle_DragonBreathMin",
|
||||
L"Particle_DragonBreathMax",
|
||||
L"Particle_Suspend",
|
||||
|
||||
L"Particle_CritStart", // arrow in air
|
||||
L"Particle_CritEnd", // arrow in air
|
||||
|
||||
L"Effect_MovementSpeed",
|
||||
L"Effect_MovementSlowDown",
|
||||
L"Effect_DigSpeed",
|
||||
L"Effect_DigSlowdown",
|
||||
L"Effect_DamageBoost",
|
||||
L"Effect_Heal",
|
||||
L"Effect_Harm",
|
||||
L"Effect_Jump",
|
||||
L"Effect_Confusion",
|
||||
L"Effect_Regeneration",
|
||||
L"Effect_DamageResistance",
|
||||
L"Effect_FireResistance",
|
||||
L"Effect_WaterBreathing",
|
||||
L"Effect_Invisiblity",
|
||||
L"Effect_Blindness",
|
||||
L"Effect_NightVision",
|
||||
L"Effect_Hunger",
|
||||
L"Effect_Weakness",
|
||||
L"Effect_Poison",
|
||||
|
||||
L"Potion_BaseColour",
|
||||
|
||||
L"Mob_Creeper_Colour1",
|
||||
L"Mob_Creeper_Colour2",
|
||||
L"Mob_Skeleton_Colour1",
|
||||
L"Mob_Skeleton_Colour2",
|
||||
L"Mob_Spider_Colour1",
|
||||
L"Mob_Spider_Colour2",
|
||||
L"Mob_Zombie_Colour1",
|
||||
L"Mob_Zombie_Colour2",
|
||||
L"Mob_Slime_Colour1",
|
||||
L"Mob_Slime_Colour2",
|
||||
L"Mob_Ghast_Colour1",
|
||||
L"Mob_Ghast_Colour2",
|
||||
L"Mob_PigZombie_Colour1",
|
||||
L"Mob_PigZombie_Colour2",
|
||||
L"Mob_Enderman_Colour1",
|
||||
L"Mob_Enderman_Colour2",
|
||||
L"Mob_CaveSpider_Colour1",
|
||||
L"Mob_CaveSpider_Colour2",
|
||||
L"Mob_Silverfish_Colour1",
|
||||
L"Mob_Silverfish_Colour2",
|
||||
L"Mob_Blaze_Colour1",
|
||||
L"Mob_Blaze_Colour2",
|
||||
L"Mob_LavaSlime_Colour1",
|
||||
L"Mob_LavaSlime_Colour2",
|
||||
L"Mob_Pig_Colour1",
|
||||
L"Mob_Pig_Colour2",
|
||||
L"Mob_Sheep_Colour1",
|
||||
L"Mob_Sheep_Colour2",
|
||||
L"Mob_Cow_Colour1",
|
||||
L"Mob_Cow_Colour2",
|
||||
L"Mob_Chicken_Colour1",
|
||||
L"Mob_Chicken_Colour2",
|
||||
L"Mob_Squid_Colour1",
|
||||
L"Mob_Squid_Colour2",
|
||||
L"Mob_Wolf_Colour1",
|
||||
L"Mob_Wolf_Colour2",
|
||||
L"Mob_MushroomCow_Colour1",
|
||||
L"Mob_MushroomCow_Colour2",
|
||||
L"Mob_Ocelot_Colour1",
|
||||
L"Mob_Ocelot_Colour2",
|
||||
L"Mob_Villager_Colour1",
|
||||
L"Mob_Villager_Colour2",
|
||||
|
||||
L"Armour_Default_Leather_Colour",
|
||||
L"Under_Water_Clear_Colour",
|
||||
L"Under_Lava_Clear_Colour",
|
||||
L"In_Cloud_Base_Colour",
|
||||
|
||||
L"Under_Water_Fog_Colour",
|
||||
L"Under_Lava_Fog_Colour",
|
||||
L"In_Cloud_Fog_Colour",
|
||||
|
||||
L"Default_Fog_Colour",
|
||||
L"Nether_Fog_Colour",
|
||||
L"End_Fog_Colour",
|
||||
|
||||
L"Sign_Text",
|
||||
L"Map_Text",
|
||||
|
||||
L"HTMLColor_0",
|
||||
L"HTMLColor_1",
|
||||
L"HTMLColor_2",
|
||||
L"HTMLColor_3",
|
||||
L"HTMLColor_4",
|
||||
L"HTMLColor_5",
|
||||
L"HTMLColor_6",
|
||||
L"HTMLColor_7",
|
||||
L"HTMLColor_8",
|
||||
L"HTMLColor_9",
|
||||
L"HTMLColor_a",
|
||||
L"HTMLColor_b",
|
||||
L"HTMLColor_c",
|
||||
L"HTMLColor_d",
|
||||
L"HTMLColor_e",
|
||||
L"HTMLColor_f",
|
||||
L"HTMLColor_dark_0",
|
||||
L"HTMLColor_dark_1",
|
||||
L"HTMLColor_dark_2",
|
||||
L"HTMLColor_dark_3",
|
||||
L"HTMLColor_dark_4",
|
||||
L"HTMLColor_dark_5",
|
||||
L"HTMLColor_dark_6",
|
||||
L"HTMLColor_dark_7",
|
||||
L"HTMLColor_dark_8",
|
||||
L"HTMLColor_dark_9",
|
||||
L"HTMLColor_dark_a",
|
||||
L"HTMLColor_dark_b",
|
||||
L"HTMLColor_dark_c",
|
||||
L"HTMLColor_dark_d",
|
||||
L"HTMLColor_dark_e",
|
||||
L"HTMLColor_dark_f",
|
||||
L"HTMLColor_T1",
|
||||
L"HTMLColor_T2",
|
||||
L"HTMLColor_T3",
|
||||
L"HTMLColor_Black",
|
||||
L"HTMLColor_White",
|
||||
L"Color_EnchantText",
|
||||
L"Color_EnchantTextFocus",
|
||||
L"Color_EnchantTextDisabled",
|
||||
L"Color_RenamedItemTitle",
|
||||
};
|
||||
|
||||
void ColourTable::staticCtor()
|
||||
{
|
||||
for(unsigned int i = eMinecraftColour_NOT_SET; i < eMinecraftColour_COUNT; ++i)
|
||||
{
|
||||
s_colourNamesMap.insert( unordered_map<wstring,eMinecraftColour>::value_type( ColourTableElements[i], (eMinecraftColour)i) );
|
||||
}
|
||||
}
|
||||
|
||||
ColourTable::ColourTable(PBYTE pbData, DWORD dwLength)
|
||||
{
|
||||
loadColoursFromData(pbData, dwLength);
|
||||
}
|
||||
|
||||
ColourTable::ColourTable(ColourTable *defaultColours, PBYTE pbData, DWORD dwLength)
|
||||
{
|
||||
// 4J Stu - Default the colours that of the table passed in
|
||||
XMemCpy( (void *)m_colourValues, (void *)defaultColours->m_colourValues, sizeof(int) * eMinecraftColour_COUNT);
|
||||
loadColoursFromData(pbData, dwLength);
|
||||
}
|
||||
void ColourTable::loadColoursFromData(PBYTE pbData, DWORD dwLength)
|
||||
{
|
||||
byteArray src(pbData, dwLength);
|
||||
|
||||
ByteArrayInputStream bais(src);
|
||||
DataInputStream dis(&bais);
|
||||
|
||||
int versionNumber = dis.readInt();
|
||||
int coloursCount = dis.readInt();
|
||||
|
||||
for(int i = 0; i < coloursCount; ++i)
|
||||
{
|
||||
wstring colourId = dis.readUTF();
|
||||
int colourValue = dis.readInt();
|
||||
setColour(colourId, colourValue);
|
||||
AUTO_VAR(it,s_colourNamesMap.find(colourId));
|
||||
}
|
||||
|
||||
bais.reset();
|
||||
}
|
||||
|
||||
void ColourTable::setColour(const wstring &colourName, int value)
|
||||
{
|
||||
AUTO_VAR(it,s_colourNamesMap.find(colourName));
|
||||
if(it != s_colourNamesMap.end())
|
||||
{
|
||||
m_colourValues[(int)it->second] = value;
|
||||
}
|
||||
}
|
||||
|
||||
void ColourTable::setColour(const wstring &colourName, const wstring &value)
|
||||
{
|
||||
setColour(colourName, _fromHEXString<int>(value));
|
||||
}
|
||||
|
||||
unsigned int ColourTable::getColour(eMinecraftColour id)
|
||||
{
|
||||
return m_colourValues[(int)id];
|
||||
}
|
||||
23
Minecraft.Client/Common/Colours/ColourTable.h
Normal file
23
Minecraft.Client/Common/Colours/ColourTable.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
class ColourTable
|
||||
{
|
||||
private:
|
||||
unsigned int m_colourValues[eMinecraftColour_COUNT];
|
||||
|
||||
static wchar_t *ColourTableElements[eMinecraftColour_COUNT];
|
||||
static unordered_map<wstring,eMinecraftColour> s_colourNamesMap;
|
||||
|
||||
public:
|
||||
static void staticCtor();
|
||||
|
||||
ColourTable(PBYTE pbData, DWORD dwLength);
|
||||
ColourTable(ColourTable *defaultColours, PBYTE pbData, DWORD dwLength);
|
||||
|
||||
unsigned int getColour(eMinecraftColour id);
|
||||
unsigned int getColor(eMinecraftColour id) { return getColour(id); }
|
||||
|
||||
void loadColoursFromData(PBYTE pbData, DWORD dwLength);
|
||||
void setColour(const wstring &colourName, int value);
|
||||
void setColour(const wstring &colourName, const wstring &value);
|
||||
};
|
||||
28
Minecraft.Client/Common/CommonMedia.sln
Normal file
28
Minecraft.Client/Common/CommonMedia.sln
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonMedia", "CommonMedia.vcxproj", "{21BBD32C-AF5E-4741-8B80-3B73FC0D0F27}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(TeamFoundationVersionControl) = preSolution
|
||||
SccNumberOfProjects = 2
|
||||
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
|
||||
SccTeamFoundationServer = http://tfs_server:8080/tfs/storiespark
|
||||
SccProjectUniqueName0 = CommonMedia.vcxproj
|
||||
SccLocalPath0 = .
|
||||
SccLocalPath1 = .
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{21BBD32C-AF5E-4741-8B80-3B73FC0D0F27}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{21BBD32C-AF5E-4741-8B80-3B73FC0D0F27}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{21BBD32C-AF5E-4741-8B80-3B73FC0D0F27}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{21BBD32C-AF5E-4741-8B80-3B73FC0D0F27}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
115
Minecraft.Client/Common/CommonMedia.vcxproj
Normal file
115
Minecraft.Client/Common/CommonMedia.vcxproj
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Media\ChestMenu720.swf" />
|
||||
<None Include="Media\CreateWorldMenu720.swf" />
|
||||
<None Include="Media\CreativeMenu720.swf" />
|
||||
<None Include="Media\DebugMenu720.swf" />
|
||||
<None Include="Media\FullscreenProgress720.swf" />
|
||||
<None Include="Media\HUD720.swf" />
|
||||
<None Include="Media\InventoryMenu720.swf" />
|
||||
<None Include="Media\languages.loc" />
|
||||
<None Include="Media\LaunchMoreOptionsMenu720.swf" />
|
||||
<None Include="Media\LoadMenu720.swf" />
|
||||
<None Include="Media\LoadOrJoinMenu720.swf" />
|
||||
<None Include="Media\MainMenu720.swf" />
|
||||
<None Include="Media\media.arc" />
|
||||
<None Include="Media\Panorama720.swf" />
|
||||
<None Include="Media\PauseMenu720.swf" />
|
||||
<None Include="Media\skin.swf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Media\strings.resx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="Media\media.txt" />
|
||||
<Text Include="Media\strings_begin.txt" />
|
||||
<Text Include="Media\strings_Controls.txt" />
|
||||
<Text Include="Media\strings_Credits.txt" />
|
||||
<Text Include="Media\strings_Descriptions.txt" />
|
||||
<Text Include="Media\strings_end.txt" />
|
||||
<Text Include="Media\strings_HowToPlay.txt" />
|
||||
<Text Include="Media\strings_ItemsAndTiles.txt" />
|
||||
<Text Include="Media\strings_Misc.txt" />
|
||||
<Text Include="Media\strings_PotionsAndEnchantments.txt" />
|
||||
<Text Include="Media\strings_Tips.txt" />
|
||||
<Text Include="Media\strings_Tooltips.txt" />
|
||||
<Text Include="Media\strings_Tutorial.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Durango\strings.h" />
|
||||
<ClInclude Include="..\Orbis\strings.h" />
|
||||
<ClInclude Include="..\PS3\strings.h" />
|
||||
<ClInclude Include="..\Windows64\strings.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{21BBD32C-AF5E-4741-8B80-3B73FC0D0F27}</ProjectGuid>
|
||||
<Keyword>MakeFileProj</Keyword>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<NMakeBuildCommandLine>echo Creating languages.loc
|
||||
copy .\Media\strings.resx .\Media\en-EN.lang
|
||||
copy .\Media\fr-FR\strings.resx .\Media\fr-FR\fr-FR.lang
|
||||
copy .\Media\ja-JP\strings.resx .\Media\ja-JP\ja-JP.lang
|
||||
..\..\..\Tools\NewLocalisationPacker.exe --static .\Media .\Media\languages.loc
|
||||
|
||||
echo Making archive
|
||||
..\..\..\Tools\ArchiveFilePacker.exe -cd $(ProjectDir)\Media media.arc media.txt
|
||||
|
||||
echo Copying Durango strings.h
|
||||
copy .\Media\strings.h ..\Durango\strings.h
|
||||
|
||||
echo Copying PS3 strings.h
|
||||
copy .\Media\strings.h ..\PS3\strings.h
|
||||
|
||||
echo Copying PS4 strings.h
|
||||
copy .\Media\strings.h ..\Orbis\strings.h
|
||||
|
||||
echo Copying Win strings.h
|
||||
copy .\Media\strings.h ..\Windows64\strings.h</NMakeBuildCommandLine>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<NMakePreprocessorDefinitions>WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
136
Minecraft.Client/Common/CommonMedia.vcxproj.filters
Normal file
136
Minecraft.Client/Common/CommonMedia.vcxproj.filters
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="IggyMedia">
|
||||
<UniqueIdentifier>{55c7ab2e-b3e5-4aed-9ffe-3308591d9c34}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Strings">
|
||||
<UniqueIdentifier>{eaa0eb72-0b27-4080-ad53-f68e42f37ba8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Archive">
|
||||
<UniqueIdentifier>{711ad95b-eb56-4e18-b001-34ad7b8075a3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Archive\Win64">
|
||||
<UniqueIdentifier>{1432ec3d-c5d0-46da-91b6-e7737095a97e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Archive\PS4">
|
||||
<UniqueIdentifier>{4b2aeaf1-04d7-454d-b2d9-08364799831c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Archive\PS3">
|
||||
<UniqueIdentifier>{4b0eaef6-fa2f-4605-b0da-a81ffb5659bc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Archive\Durango">
|
||||
<UniqueIdentifier>{bf1c74da-21f1-4bdd-98ed-83457946e4cc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Media\ChestMenu720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\CreateWorldMenu720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\CreativeMenu720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\DebugMenu720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\FullscreenProgress720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\HUD720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\InventoryMenu720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\media.arc">
|
||||
<Filter>Archive</Filter>
|
||||
</None>
|
||||
<None Include="Media\languages.loc">
|
||||
<Filter>Archive</Filter>
|
||||
</None>
|
||||
<None Include="Media\skin.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\MainMenu720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\Panorama720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\LoadOrJoinMenu720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\LaunchMoreOptionsMenu720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\LoadMenu720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
<None Include="Media\PauseMenu720.swf">
|
||||
<Filter>IggyMedia</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Media\strings.resx">
|
||||
<Filter>Strings</Filter>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="Media\strings_begin.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_Controls.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_Credits.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_Descriptions.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_end.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_HowToPlay.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_ItemsAndTiles.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_Misc.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_PotionsAndEnchantments.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_Tips.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_Tooltips.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\strings_Tutorial.txt">
|
||||
<Filter>Strings</Filter>
|
||||
</Text>
|
||||
<Text Include="Media\media.txt">
|
||||
<Filter>Archive</Filter>
|
||||
</Text>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Durango\strings.h">
|
||||
<Filter>Archive\Durango</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\PS3\strings.h">
|
||||
<Filter>Archive\PS3</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Orbis\strings.h">
|
||||
<Filter>Archive\PS4</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Windows64\strings.h">
|
||||
<Filter>Archive\Win64</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
9
Minecraft.Client/Common/ConsoleGameMode.cpp
Normal file
9
Minecraft.Client/Common/ConsoleGameMode.cpp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include "stdafx.h"
|
||||
#include "ConsoleGameMode.h"
|
||||
#include "..\Common\Tutorial\Tutorial.h"
|
||||
|
||||
ConsoleGameMode::ConsoleGameMode(int iPad, Minecraft *minecraft, ClientConnection *connection)
|
||||
: TutorialMode(iPad, minecraft, connection)
|
||||
{
|
||||
tutorial = new Tutorial(iPad);
|
||||
}
|
||||
10
Minecraft.Client/Common/ConsoleGameMode.h
Normal file
10
Minecraft.Client/Common/ConsoleGameMode.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
#include "..\Common\Tutorial\TutorialMode.h"
|
||||
|
||||
class ConsoleGameMode : public TutorialMode
|
||||
{
|
||||
public:
|
||||
ConsoleGameMode(int iPad, Minecraft *minecraft, ClientConnection *connection);
|
||||
|
||||
virtual bool isImplemented() { return true; }
|
||||
};
|
||||
72
Minecraft.Client/Common/Console_Awards_enum.h
Normal file
72
Minecraft.Client/Common/Console_Awards_enum.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#pragma once
|
||||
|
||||
enum eAward
|
||||
{
|
||||
eAward_TakingInventory=0,
|
||||
eAward_GettingWood,
|
||||
eAward_Benchmarking,
|
||||
eAward_TimeToMine,
|
||||
eAward_HotTopic,
|
||||
eAward_AquireHardware,
|
||||
eAward_TimeToFarm,
|
||||
eAward_BakeBread,
|
||||
eAward_TheLie,
|
||||
eAward_GettingAnUpgrade,
|
||||
eAward_DeliciousFish,
|
||||
eAward_OnARail,
|
||||
eAward_TimeToStrike,
|
||||
eAward_MonsterHunter,
|
||||
eAward_CowTipper,
|
||||
eAward_WhenPigsFly,
|
||||
eAward_LeaderOfThePack,
|
||||
eAward_MOARTools,
|
||||
eAward_DispenseWithThis,
|
||||
eAward_InToTheNether,
|
||||
|
||||
eAward_mine100Blocks,
|
||||
eAward_kill10Creepers,
|
||||
eAward_eatPorkChop,
|
||||
eAward_play100Days,
|
||||
eAward_arrowKillCreeper,
|
||||
eAward_socialPost,
|
||||
|
||||
#ifndef _XBOX
|
||||
// 4J Stu - Does not map to any Xbox achievements
|
||||
eAward_snipeSkeleton,
|
||||
eAward_diamonds,
|
||||
eAward_portal,
|
||||
eAward_ghast,
|
||||
eAward_blazeRod,
|
||||
eAward_potion,
|
||||
eAward_theEnd,
|
||||
eAward_winGame,
|
||||
eAward_enchantments,
|
||||
eAward_overkill,
|
||||
eAward_bookcase,
|
||||
#endif
|
||||
|
||||
#ifdef _EXTENDED_ACHIEVEMENTS
|
||||
eAward_adventuringTime,
|
||||
eAward_repopulation,
|
||||
//eAward_porkChop,
|
||||
eAward_diamondsToYou,
|
||||
//eAward_passingTheTime,
|
||||
//eAward_archer,
|
||||
eAward_theHaggler,
|
||||
eAward_potPlanter,
|
||||
eAward_itsASign,
|
||||
eAward_ironBelly,
|
||||
eAward_haveAShearfulDay,
|
||||
eAward_rainbowCollection,
|
||||
eAward_stayinFrosty,
|
||||
eAward_chestfulOfCobblestone,
|
||||
eAward_renewableEnergy,
|
||||
eAward_musicToMyEars,
|
||||
eAward_bodyGuard,
|
||||
eAward_ironMan,
|
||||
eAward_zombieDoctor,
|
||||
eAward_lionTamer,
|
||||
#endif
|
||||
|
||||
eAward_Max,
|
||||
};
|
||||
42
Minecraft.Client/Common/Console_Debug_enum.h
Normal file
42
Minecraft.Client/Common/Console_Debug_enum.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
enum eDebugSetting
|
||||
{
|
||||
eDebugSetting_LoadSavesFromDisk,
|
||||
eDebugSetting_WriteSavesToDisk,
|
||||
eDebugSetting_FreezePlayers, //eDebugSetting_InterfaceOff,
|
||||
eDebugSetting_Safearea,
|
||||
eDebugSetting_MobsDontAttack,
|
||||
eDebugSetting_FreezeTime,
|
||||
eDebugSetting_DisableWeather,
|
||||
eDebugSetting_CraftAnything,
|
||||
eDebugSetting_UseDpadForDebug,
|
||||
eDebugSetting_MobsDontTick,
|
||||
eDebugSetting_InstantDestroy,
|
||||
eDebugSetting_ShowUIConsole,
|
||||
eDebugSetting_DistributableSave,
|
||||
eDebugSetting_DebugLeaderboards,
|
||||
eDebugSetting_EnableHeightWaterBiomeOverride, //eDebugSetting_TipsAlwaysOn,
|
||||
eDebugSetting_SuperflatNether,
|
||||
//eDebugSetting_LightDarkBackground,
|
||||
eDebugSetting_RegularLightning,
|
||||
eDebugSetting_GoToNether,
|
||||
//eDebugSetting_GoToEnd,
|
||||
eDebugSetting_GoToOverworld,
|
||||
eDebugSetting_UnlockAllDLC, // eDebugSetting_ToggleFont,
|
||||
eDebugSetting_ShowUIMarketingGuide,
|
||||
eDebugSetting_Max,
|
||||
};
|
||||
|
||||
enum eDebugButton
|
||||
{
|
||||
eDebugButton_Theme=0,
|
||||
eDebugButton_Avatar_Item_1,
|
||||
eDebugButton_Avatar_Item_2,
|
||||
eDebugButton_Avatar_Item_3,
|
||||
eDebugButton_Gamerpic_1,
|
||||
eDebugButton_Gamerpic_2,
|
||||
eDebugButton_CheckTips,
|
||||
eDebugButton_WipeLeaderboards,
|
||||
eDebugButton_Max,
|
||||
};
|
||||
40
Minecraft.Client/Common/Console_Utils.cpp
Normal file
40
Minecraft.Client/Common/Console_Utils.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: DebugSpewV()
|
||||
// Desc: Internal helper function
|
||||
//--------------------------------------------------------------------------------------
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
static VOID DebugSpewV( const CHAR* strFormat, const va_list pArgList )
|
||||
{
|
||||
#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__
|
||||
assert(0);
|
||||
#else
|
||||
CHAR str[2048];
|
||||
// Use the secure CRT to avoid buffer overruns. Specify a count of
|
||||
// _TRUNCATE so that too long strings will be silently truncated
|
||||
// rather than triggering an error.
|
||||
_vsnprintf_s( str, _TRUNCATE, strFormat, pArgList );
|
||||
OutputDebugStringA( str );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Name: DebugSpew()
|
||||
// Desc: Prints formatted debug spew
|
||||
//--------------------------------------------------------------------------------------
|
||||
#ifdef _Printf_format_string_ // VC++ 2008 and later support this annotation
|
||||
VOID CDECL DebugSpew( _In_z_ _Printf_format_string_ const CHAR* strFormat, ... )
|
||||
#else
|
||||
VOID CDECL DebugPrintf( const CHAR* strFormat, ... )
|
||||
#endif
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
va_list pArgList;
|
||||
va_start( pArgList, strFormat );
|
||||
DebugSpewV( strFormat, pArgList );
|
||||
va_end( pArgList );
|
||||
#endif
|
||||
}
|
||||
|
||||
9539
Minecraft.Client/Common/Consoles_App.cpp
Normal file
9539
Minecraft.Client/Common/Consoles_App.cpp
Normal file
File diff suppressed because it is too large
Load diff
911
Minecraft.Client/Common/Consoles_App.h
Normal file
911
Minecraft.Client/Common/Consoles_App.h
Normal file
|
|
@ -0,0 +1,911 @@
|
|||
#pragma once
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "Audio/Consoles_SoundEngine.h"
|
||||
|
||||
#include <xuiapp.h>
|
||||
#include "..\Common\Tutorial\TutorialEnum.h"
|
||||
|
||||
#ifdef _XBOX
|
||||
#include "..\Common\XUI\XUI_Helper.h"
|
||||
#include "..\Common\XUI\XUI_HelpCredits.h"
|
||||
#endif
|
||||
#include "UI\UIStructs.h"
|
||||
|
||||
#include "..\..\Minecraft.World\DisconnectPacket.h"
|
||||
#include <xsocialpost.h>
|
||||
|
||||
#include "..\StringTable.h"
|
||||
#include "..\Common\DLC\DLCManager.h"
|
||||
#include "..\Common\GameRules\ConsoleGameRulesConstants.h"
|
||||
#include "..\Common\GameRules\GameRuleManager.h"
|
||||
#include "..\SkinBox.h"
|
||||
#include "..\ArchiveFile.h"
|
||||
|
||||
typedef struct _JoinFromInviteData
|
||||
{
|
||||
DWORD dwUserIndex; // dwUserIndex
|
||||
DWORD dwLocalUsersMask; // dwUserMask
|
||||
const INVITE_INFO *pInviteInfo; // pInviteInfo
|
||||
}
|
||||
JoinFromInviteData;
|
||||
|
||||
class Player;
|
||||
class Inventory;
|
||||
class Level;
|
||||
class FurnaceTileEntity;
|
||||
class Container;
|
||||
class DispenserTileEntity;
|
||||
class SignTileEntity;
|
||||
class BrewingStandTileEntity;
|
||||
class LocalPlayer;
|
||||
class DLCPack;
|
||||
class LevelRuleset;
|
||||
class ConsoleSchematicFile;
|
||||
class Model;
|
||||
class ModelPart;
|
||||
class StringTable;
|
||||
class Merchant;
|
||||
|
||||
class CMinecraftAudio;
|
||||
|
||||
class CMinecraftApp
|
||||
|
||||
#ifdef _XBOX
|
||||
: public CXuiModule
|
||||
#endif
|
||||
{
|
||||
private:
|
||||
static int s_iHTMLFontSizesA[eHTMLSize_COUNT];
|
||||
|
||||
public:
|
||||
|
||||
CMinecraftApp();
|
||||
|
||||
static const float fSafeZoneX; // 5% of 1280
|
||||
static const float fSafeZoneY; // 5% of 720
|
||||
|
||||
typedef std::vector <PMEMDATA> VMEMFILES;
|
||||
typedef std::vector <PNOTIFICATION> VNOTIFICATIONS;
|
||||
|
||||
// storing skin files
|
||||
std::vector <wstring > vSkinNames;
|
||||
DLCManager m_dlcManager;
|
||||
|
||||
// storing credits text from the DLC
|
||||
std::vector <wstring > m_vCreditText; // hold the credit text lines so we can avoid duplicating them
|
||||
|
||||
|
||||
// In builds prior to TU5, the size of the GAME_SETTINGS struct was 204 bytes. We added a few new values to the internal struct in TU5, and even though we
|
||||
// changed the size of the ucUnused array to be decreased by the size of the values we added, the packing of the struct has introduced some extra
|
||||
// padding that resulted in the GAME_SETTINGS struct being 208 bytes. The knock-on effect from this was that all the stats, which come after the game settings
|
||||
// in the profile data, we being read offset by 4 bytes. We need to ensure that the GAME_SETTINGS struct does not grow larger than 204 bytes or if we need it
|
||||
// to then we need to rebuild the profile data completely and increase the profile version. There should be enough free space to grow larger for a few more updates
|
||||
// as long as we take into account the padding issues and check that settings are still stored at the same positions when we read them
|
||||
static const int GAME_SETTINGS_PROFILE_DATA_BYTES = 204;
|
||||
|
||||
#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.
|
||||
*/
|
||||
static const int GAME_DEFINED_PROFILE_DATA_BYTES = 2*972; // per user
|
||||
#else
|
||||
static const int GAME_DEFINED_PROFILE_DATA_BYTES = 972; // per user
|
||||
#endif
|
||||
unsigned int uiGameDefinedDataChangedBitmask;
|
||||
|
||||
void DebugPrintf(const char *szFormat, ...);
|
||||
void DebugPrintfVerbose(bool bVerbose, const char *szFormat, ...); // Conditional printf
|
||||
void DebugPrintf(int user, const char *szFormat, ...);
|
||||
|
||||
static const int USER_NONE = 0; // disables printf
|
||||
static const int USER_GENERAL = 1;
|
||||
static const int USER_JV = 2;
|
||||
static const int USER_MH = 3;
|
||||
static const int USER_PB = 4;
|
||||
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;}
|
||||
#ifdef _CONTENT_PACKAGE
|
||||
#ifndef _FINAL_BUILD
|
||||
bool PartnernetPasswordRunning() { return m_bPartnernetPasswordRunning;}
|
||||
void SetPartnernetPasswordRunning(bool bSet) {m_bPartnernetPasswordRunning=bSet;}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool IsAppPaused();
|
||||
void SetAppPaused(bool val);
|
||||
static int DisplaySavingMessage(LPVOID pParam,const C4JStorage::ESavingMessage eMsg, int iPad);
|
||||
bool GetGameStarted() {return m_bGameStarted;}
|
||||
void SetGameStarted(bool bVal) { if(bVal) DebugPrintf("SetGameStarted - true\n"); else DebugPrintf("SetGameStarted - false\n"); m_bGameStarted = bVal; m_bIsAppPaused = !bVal;}
|
||||
int GetLocalPlayerCount(void);
|
||||
bool LoadInventoryMenu(int iPad,shared_ptr<LocalPlayer> player, bool bNavigateBack=false);
|
||||
bool LoadCreativeMenu(int iPad,shared_ptr<LocalPlayer> player,bool bNavigateBack=false);
|
||||
bool LoadEnchantingMenu(int iPad,shared_ptr<Inventory> inventory, int x, int y, int z, Level *level);
|
||||
bool LoadFurnaceMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<FurnaceTileEntity> furnace);
|
||||
bool LoadBrewingStandMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<BrewingStandTileEntity> brewingStand);
|
||||
bool LoadContainerMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<Container> container);
|
||||
bool LoadTrapMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<DispenserTileEntity> trap);
|
||||
bool LoadCrafting2x2Menu(int iPad,shared_ptr<LocalPlayer> player);
|
||||
bool LoadCrafting3x3Menu(int iPad,shared_ptr<LocalPlayer> player, int x, int y, int z);
|
||||
bool LoadSignEntryMenu(int iPad,shared_ptr<SignTileEntity> sign);
|
||||
bool LoadRepairingMenu(int iPad,shared_ptr<Inventory> inventory, Level *level, int x, int y, int z);
|
||||
bool LoadTradingMenu(int iPad, shared_ptr<Inventory> inventory, shared_ptr<Merchant> trader, Level *level);
|
||||
|
||||
bool GetTutorialMode() { return m_bTutorialMode;}
|
||||
void SetTutorialMode(bool bSet) {m_bTutorialMode=bSet;}
|
||||
|
||||
void SetSpecialTutorialCompletionFlag(int iPad, int index);
|
||||
|
||||
static LPCWSTR GetString(int iID);
|
||||
|
||||
eGameMode GetGameMode() { return m_eGameMode;}
|
||||
void SetGameMode(eGameMode eMode) { m_eGameMode=eMode;}
|
||||
|
||||
eXuiAction GetGlobalXuiAction() {return m_eGlobalXuiAction;}
|
||||
void SetGlobalXuiAction(eXuiAction action) {m_eGlobalXuiAction=action;}
|
||||
eXuiAction GetXuiAction(int iPad) {return m_eXuiAction[iPad];}
|
||||
void SetAction(int iPad, eXuiAction action, LPVOID param = NULL);
|
||||
void SetTMSAction(int iPad, eTMSAction action) {m_eTMSAction[iPad]=action; }
|
||||
eTMSAction GetTMSAction(int iPad) {return m_eTMSAction[iPad];}
|
||||
eXuiServerAction GetXuiServerAction(int iPad) {return m_eXuiServerAction[iPad];}
|
||||
LPVOID GetXuiServerActionParam(int iPad) {return m_eXuiServerActionParam[iPad];}
|
||||
void SetXuiServerAction(int iPad, eXuiServerAction action, LPVOID param = NULL) {m_eXuiServerAction[iPad]=action; m_eXuiServerActionParam[iPad] = param;}
|
||||
eXuiServerAction GetGlobalXuiServerAction() {return m_eGlobalXuiServerAction;}
|
||||
void SetGlobalXuiServerAction(eXuiServerAction action) {m_eGlobalXuiServerAction=action;}
|
||||
|
||||
DisconnectPacket::eDisconnectReason GetDisconnectReason() { return m_disconnectReason; }
|
||||
void SetDisconnectReason(DisconnectPacket::eDisconnectReason bVal) { m_disconnectReason = bVal; }
|
||||
|
||||
bool GetChangingSessionType() { return m_bChangingSessionType; }
|
||||
void SetChangingSessionType(bool bVal) { m_bChangingSessionType = bVal; }
|
||||
|
||||
bool GetReallyChangingSessionType() { return m_bReallyChangingSessionType; }
|
||||
void SetReallyChangingSessionType(bool bVal) { m_bReallyChangingSessionType = bVal; }
|
||||
|
||||
|
||||
// 4J Stu - Added so that we can call this when a confirmation box is selected
|
||||
static void SetActionConfirmed(LPVOID param);
|
||||
void HandleXuiActions(void);
|
||||
|
||||
// 4J Stu - Functions used for Minecon and other promo work
|
||||
bool GetLoadSavesFromFolderEnabled() { return m_bLoadSavesFromFolderEnabled; }
|
||||
void SetLoadSavesFromFolderEnabled(bool bVal) { m_bLoadSavesFromFolderEnabled = bVal; }
|
||||
|
||||
// 4J Stu - Useful for debugging
|
||||
bool GetWriteSavesToFolderEnabled() { return m_bWriteSavesToFolderEnabled; }
|
||||
void SetWriteSavesToFolderEnabled(bool bVal) { m_bWriteSavesToFolderEnabled = bVal; }
|
||||
bool GetMobsDontAttackEnabled() { return m_bMobsDontAttack; }
|
||||
void SetMobsDontAttackEnabled(bool bVal) { m_bMobsDontAttack = bVal; }
|
||||
bool GetUseDPadForDebug() { return m_bUseDPadForDebug; }
|
||||
void SetUseDPadForDebug(bool bVal) { m_bUseDPadForDebug = bVal; }
|
||||
bool GetMobsDontTickEnabled() { return m_bMobsDontTick; }
|
||||
void SetMobsDontTickEnabled(bool bVal) { m_bMobsDontTick = bVal; }
|
||||
|
||||
bool GetFreezePlayers() { return m_bFreezePlayers; }
|
||||
void SetFreezePlayers(bool bVal) { m_bFreezePlayers = bVal; }
|
||||
|
||||
// debug -0 show safe area
|
||||
void ShowSafeArea(BOOL bShow)
|
||||
{
|
||||
#ifdef _XBOX
|
||||
CXuiSceneBase::ShowSafeArea( bShow );
|
||||
#endif
|
||||
}
|
||||
// 4J-PB - to capture the social post screenshot
|
||||
virtual void CaptureScreenshot(int iPad) {};
|
||||
//void GetPreviewImage(int iPad,XSOCIAL_PREVIEWIMAGE *preview);
|
||||
|
||||
void InitGameSettings();
|
||||
static int OldProfileVersionCallback(LPVOID pParam,unsigned char *pucData, const unsigned short usVersion, const int iPad);
|
||||
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__ )
|
||||
static int DefaultOptionsCallback(LPVOID pParam,C4JStorage::PROFILESETTINGS *pSettings, const int iPad);
|
||||
int SetDefaultOptions(C4JStorage::PROFILESETTINGS *pSettings,const int iPad,bool bWriteProfile=true);
|
||||
#ifdef __ORBIS__
|
||||
static int OptionsDataCallback(LPVOID pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus,int iBlocksRequired);
|
||||
int GetOptionsBlocksRequired(int iPad);
|
||||
#else
|
||||
static int OptionsDataCallback(LPVOID pParam,int iPad,unsigned short usVersion,C4JStorage::eOptionsCallback eStatus);
|
||||
#endif
|
||||
|
||||
C4JStorage::eOptionsCallback GetOptionsCallbackStatus(int iPad);
|
||||
|
||||
void SetOptionsCallbackStatus(int iPad, C4JStorage::eOptionsCallback eStatus);
|
||||
#else
|
||||
static int DefaultOptionsCallback(LPVOID pParam,C_4JProfile::PROFILESETTINGS *pSettings, const int iPad);
|
||||
int SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,const int iPad);
|
||||
#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
|
||||
void SetPlayerSkin(int iPad,const wstring &name);
|
||||
void SetPlayerSkin(int iPad,DWORD dwSkinId);
|
||||
void SetPlayerCape(int iPad,const wstring &name);
|
||||
void SetPlayerCape(int iPad,DWORD dwCapeId);
|
||||
void SetPlayerFavoriteSkin(int iPad, int iIndex,unsigned int uiSkinID);
|
||||
unsigned int GetPlayerFavoriteSkin(int iPad,int iIndex);
|
||||
unsigned char GetPlayerFavoriteSkinsPos(int iPad);
|
||||
void SetPlayerFavoriteSkinsPos(int iPad,int iPos);
|
||||
unsigned int GetPlayerFavoriteSkinsCount(int iPad);
|
||||
void ValidateFavoriteSkins(int iPad); // check the DLC is available for the skins
|
||||
|
||||
// Mash-up pack worlds hide/display
|
||||
void HideMashupPackWorld(int iPad, unsigned int iMashupPackID);
|
||||
void EnableMashupPackWorlds(int iPad);
|
||||
unsigned int GetMashupPackWorlds(int iPad);
|
||||
|
||||
// Minecraft language select
|
||||
void SetMinecraftLanguage(int iPad, unsigned char ucLanguage);
|
||||
unsigned char GetMinecraftLanguage(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]; }
|
||||
void SetOpacityTimer(int iPad) { m_uiOpacityCountDown[iPad]=120; } // 6 seconds
|
||||
void TickOpacityTimer(int iPad) { if(m_uiOpacityCountDown[iPad]>0) m_uiOpacityCountDown[iPad]--;}
|
||||
|
||||
public:
|
||||
wstring GetPlayerSkinName(int iPad);
|
||||
DWORD GetPlayerSkinId(int iPad);
|
||||
wstring GetPlayerCapeName(int iPad);
|
||||
DWORD GetPlayerCapeId(int iPad);
|
||||
DWORD GetAdditionalModelParts(int iPad);
|
||||
void CheckGameSettingsChanged(bool bOverride5MinuteTimer=false, int iPad=XUSER_INDEX_ANY);
|
||||
void ApplyGameSettingsChanged(int iPad);
|
||||
void ClearGameSettingsChangedFlag(int iPad);
|
||||
void ActionGameSettings(int iPad,eGameSetting eVal);
|
||||
unsigned int GetGameSettingsDebugMask(int iPad=-1,bool bOverridePlayer=false);
|
||||
void SetGameSettingsDebugMask(int iPad, unsigned int uiVal);
|
||||
void ActionDebugMask(int iPad, bool bSetAllClear=false);
|
||||
|
||||
//
|
||||
bool IsLocalMultiplayerAvailable();
|
||||
|
||||
// for sign in change monitoring
|
||||
static void SignInChangeCallback(LPVOID pParam, bool bVal, unsigned int uiSignInData);
|
||||
static void ClearSignInChangeUsersMask();
|
||||
static int SignoutExitWorldThreadProc( void* lpParameter );
|
||||
static int PrimaryPlayerSignedOutReturned(void *pParam, int iPad, const C4JStorage::EMessageResult);
|
||||
static int EthernetDisconnectReturned(void *pParam, int iPad, const C4JStorage::EMessageResult);
|
||||
static void ProfileReadErrorCallback(void *pParam);
|
||||
|
||||
// FATAL LOAD ERRORS
|
||||
virtual void FatalLoadError();
|
||||
|
||||
// Notifications from the game listener to be passed to the qnet listener
|
||||
static void NotificationsCallback(LPVOID pParam,DWORD dwNotification, unsigned int uiParam);
|
||||
|
||||
// for the ethernet being disconnected
|
||||
static void LiveLinkChangeCallback(LPVOID pParam,BOOL bConnected);
|
||||
bool GetLiveLinkRequired() {return m_bLiveLinkRequired;}
|
||||
void SetLiveLinkRequired(bool required) {m_bLiveLinkRequired=required;}
|
||||
|
||||
static void UpsellReturnedCallback(LPVOID pParam, eUpsellType type, eUpsellResponse result, int iUserData);
|
||||
|
||||
#if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__
|
||||
static int NowDisplayFullVersionPurchase(void *pParam, bool bContinue, int iPad);
|
||||
static int MustSignInFullVersionPurchaseReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
#endif
|
||||
#if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__
|
||||
static int MustSignInFullVersionPurchaseReturnedExitTrial(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
bool DebugSettingsOn() { return m_bDebugOptions;}
|
||||
#else
|
||||
bool DebugSettingsOn() { return false;}
|
||||
#endif
|
||||
void SetDebugSequence(const char *pchSeq);
|
||||
static int DebugInputCallback(LPVOID pParam);
|
||||
//bool UploadFileToGlobalStorage(int iQuadrant, C4JStorage::eGlobalStorage eStorageFacility, wstring *wsFile );
|
||||
|
||||
// Installed DLC
|
||||
bool StartInstallDLCProcess(int iPad);
|
||||
static int DLCInstalledCallback(LPVOID pParam,int iOfferC,int iPad);
|
||||
void HandleDLCLicenseChange();
|
||||
static int DLCMountedCallback(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicenceMask);
|
||||
void MountNextDLC(int iPad);
|
||||
//static int DLCReadCallback(LPVOID pParam,C4JStorage::DLC_FILE_DETAILS *pDLCData);
|
||||
void HandleDLC(DLCPack *pack);
|
||||
bool DLCInstallPending() {return m_bDLCInstallPending;}
|
||||
bool DLCInstallProcessCompleted() {return m_bDLCInstallProcessCompleted;}
|
||||
void ClearDLCInstalled() { m_bDLCInstallProcessCompleted=false;}
|
||||
static int MarketplaceCountsCallback(LPVOID pParam,C4JStorage::DLC_TMS_DETAILS *,int iPad);
|
||||
|
||||
bool AlreadySeenCreditText(const wstring &wstemp);
|
||||
|
||||
void ClearNewDLCAvailable(void) { m_bNewDLCAvailable=false; m_bSeenNewDLCTip=true;}
|
||||
bool GetNewDLCAvailable() { return m_bNewDLCAvailable;}
|
||||
void DisplayNewDLCTipAgain() { m_bSeenNewDLCTip=false;}
|
||||
bool DisplayNewDLCTip() { if(!m_bSeenNewDLCTip) { m_bSeenNewDLCTip=true; return true;} else return false;}
|
||||
|
||||
// functions to store launch data, and to exit the game - required due to possibly being on a demo disc
|
||||
virtual void StoreLaunchData();
|
||||
virtual void ExitGame();
|
||||
|
||||
bool isXuidNotch(PlayerUID xuid);
|
||||
bool isXuidDeadmau5(PlayerUID xuid);
|
||||
|
||||
void AddMemoryTextureFile(const wstring &wName, PBYTE pbData, DWORD dwBytes);
|
||||
void RemoveMemoryTextureFile(const wstring &wName);
|
||||
void GetMemFileDetails(const wstring &wName,PBYTE *ppbData,DWORD *pdwBytes);
|
||||
bool IsFileInMemoryTextures(const wstring &wName);
|
||||
|
||||
// Texture Pack Data files (icon, banner, comparison shot & text)
|
||||
void AddMemoryTPDFile(int iConfig,PBYTE pbData,DWORD dwBytes);
|
||||
void RemoveMemoryTPDFile(int iConfig);
|
||||
bool IsFileInTPD(int iConfig);
|
||||
void GetTPD(int iConfig,PBYTE *ppbData,DWORD *pdwBytes);
|
||||
int GetTPDSize() {return m_MEM_TPD.size();}
|
||||
#ifndef __PS3__
|
||||
int GetTPConfigVal(WCHAR *pwchDataFile);
|
||||
#endif
|
||||
|
||||
bool DefaultCapeExists();
|
||||
//void InstallDefaultCape(); // attempt to install the default cape once per game launch
|
||||
|
||||
// invites
|
||||
//void ProcessInvite(JoinFromInviteData *pJoinData);
|
||||
void ProcessInvite(DWORD dwUserIndex, DWORD dwLocalUsersMask, const INVITE_INFO * pInviteInfo);
|
||||
|
||||
// Add credits for DLC installed
|
||||
void AddCreditText(LPCWSTR lpStr);
|
||||
|
||||
private:
|
||||
PlayerUID m_xuidNotch;
|
||||
#ifdef _DURANGO
|
||||
unordered_map<PlayerUID, PBYTE, PlayerUID::Hash> m_GTS_Files;
|
||||
#else
|
||||
unordered_map<PlayerUID, PBYTE> m_GTS_Files;
|
||||
#endif
|
||||
|
||||
// for storing memory textures - player skin
|
||||
unordered_map<wstring, PMEMDATA> m_MEM_Files;
|
||||
// for storing texture pack data files
|
||||
unordered_map<int, PMEMDATA> m_MEM_TPD;
|
||||
CRITICAL_SECTION csMemFilesLock; // For locking access to the above map
|
||||
CRITICAL_SECTION csMemTPDLock; // For locking access to the above map
|
||||
|
||||
VNOTIFICATIONS m_vNotifications;
|
||||
|
||||
public:
|
||||
// launch data
|
||||
BYTE* m_pLaunchData;
|
||||
DWORD m_dwLaunchDataSize;
|
||||
|
||||
public:
|
||||
// BAN LIST
|
||||
void AddLevelToBannedLevelList(int iPad,PlayerUID xuid, char *pszLevelName, bool bWriteToTMS);
|
||||
bool IsInBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName);
|
||||
void RemoveLevelFromBannedLevelList(int iPad, PlayerUID xuid, char *pszLevelName);
|
||||
void InvalidateBannedList(int iPad);
|
||||
void SetUniqueMapName(char *pszUniqueMapName);
|
||||
char *GetUniqueMapName(void);
|
||||
#ifdef _XBOX_ONE
|
||||
void AddLevelToBannedLevelList(int iPad, PBANNEDLISTDATA pBannedListData, bool bWriteToTMS);
|
||||
#endif
|
||||
|
||||
|
||||
public:
|
||||
bool GetResourcesLoaded() {return m_bResourcesLoaded;}
|
||||
void SetResourcesLoaded(bool bVal) {m_bResourcesLoaded=bVal;}
|
||||
|
||||
public:
|
||||
bool m_bGameStarted;
|
||||
bool m_bIntroRunning;
|
||||
bool m_bTutorialMode;
|
||||
bool m_bIsAppPaused;
|
||||
|
||||
bool m_bChangingSessionType;
|
||||
bool m_bReallyChangingSessionType;
|
||||
|
||||
bool m_bDisplayFullVersionPurchase; // for after signing in during the trial, and trying to unlock full version on an upsell
|
||||
|
||||
void loadMediaArchive();
|
||||
void loadStringTable();
|
||||
|
||||
protected:
|
||||
ArchiveFile *m_mediaArchive;
|
||||
StringTable *m_stringTable;
|
||||
|
||||
public:
|
||||
int getArchiveFileSize(const wstring &filename);
|
||||
bool hasArchiveFile(const wstring &filename);
|
||||
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);
|
||||
|
||||
bool m_bResourcesLoaded;
|
||||
|
||||
// Global string table for this application.
|
||||
//CXuiStringTable StringTable;
|
||||
|
||||
|
||||
// Container scene for some menu
|
||||
|
||||
// CXuiScene debugContainerScene;
|
||||
|
||||
|
||||
//bool m_bSplitScreenEnabled;
|
||||
|
||||
|
||||
#ifdef _CONTENT_PACKAGE
|
||||
#ifndef _FINAL_BUILD
|
||||
bool m_bPartnernetPasswordRunning;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
eGameMode m_eGameMode; // single or multiplayer
|
||||
|
||||
static unsigned int m_uiLastSignInData;
|
||||
|
||||
// We've got sizeof(GAME_SETTINGS) bytes reserved at the start of the gamedefined data per player for settings
|
||||
GAME_SETTINGS *GameSettingsA[XUSER_MAX_COUNT];
|
||||
|
||||
// For promo work
|
||||
bool m_bLoadSavesFromFolderEnabled;
|
||||
|
||||
// For debugging
|
||||
bool m_bWriteSavesToFolderEnabled;
|
||||
bool m_bMobsDontAttack;
|
||||
bool m_bUseDPadForDebug;
|
||||
bool m_bMobsDontTick;
|
||||
bool m_bFreezePlayers;
|
||||
|
||||
// 4J : WESTY : For taking screen shots.
|
||||
//bool m_bInterfaceRenderingOff;
|
||||
//bool m_bHandRenderingOff;
|
||||
|
||||
DisconnectPacket::eDisconnectReason m_disconnectReason;
|
||||
|
||||
public:
|
||||
virtual void RunFrame() {};
|
||||
|
||||
|
||||
|
||||
static const DWORD m_dwOfferID = 0x00000001;
|
||||
|
||||
// timer
|
||||
void InitTime();
|
||||
void UpdateTime();
|
||||
|
||||
// trial timer
|
||||
void SetTrialTimerStart(void);
|
||||
float getTrialTimer(void);
|
||||
|
||||
// notifications from the game for qnet
|
||||
VNOTIFICATIONS *GetNotifications() {return &m_vNotifications;}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
// To avoid problems with threads being kicked off from xuis that alter things that may be in progress within the run_middle,
|
||||
// we'll action these at the end of the game loop
|
||||
eXuiAction m_eXuiAction[XUSER_MAX_COUNT];
|
||||
eTMSAction m_eTMSAction[XUSER_MAX_COUNT];
|
||||
LPVOID m_eXuiActionParam[XUSER_MAX_COUNT];
|
||||
eXuiAction m_eGlobalXuiAction;
|
||||
eXuiServerAction m_eXuiServerAction[XUSER_MAX_COUNT];
|
||||
LPVOID m_eXuiServerActionParam[XUSER_MAX_COUNT];
|
||||
eXuiServerAction m_eGlobalXuiServerAction;
|
||||
|
||||
bool m_bLiveLinkRequired;
|
||||
|
||||
static int UnlockFullExitReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int UnlockFullInviteReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int TrialOverReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ExitAndJoinFromInvite(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ExitAndJoinFromInviteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ExitAndJoinFromInviteAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int ExitAndJoinFromInviteDeclineSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int FatalErrorDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
static int WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
|
||||
JoinFromInviteData m_InviteData;
|
||||
bool m_bDebugOptions; // toggle debug things on or off
|
||||
|
||||
// Trial timer
|
||||
float m_fTrialTimerStart,mfTrialPausedTime;
|
||||
typedef struct TimeInfo
|
||||
{
|
||||
LARGE_INTEGER qwTime;
|
||||
LARGE_INTEGER qwAppTime;
|
||||
|
||||
float fAppTime;
|
||||
float fElapsedTime;
|
||||
float fSecsPerTick;
|
||||
} TIMEINFO;
|
||||
|
||||
TimeInfo m_Time;
|
||||
|
||||
protected:
|
||||
static const int MAX_TIPS_GAMETIP = 50;
|
||||
static const int MAX_TIPS_TRIVIATIP = 20;
|
||||
static TIPSTRUCT m_GameTipA[MAX_TIPS_GAMETIP];
|
||||
static TIPSTRUCT m_TriviaTipA[MAX_TIPS_TRIVIATIP];
|
||||
static Random *TipRandom;
|
||||
public:
|
||||
void InitialiseTips();
|
||||
UINT GetNextTip();
|
||||
int GetHTMLColour(eMinecraftColour colour);
|
||||
int GetHTMLColor(eMinecraftColour colour) { return GetHTMLColour(colour); }
|
||||
int GetHTMLFontSize(EHTMLFontSize size);
|
||||
wstring FormatHTMLString(int iPad, const wstring &desc, int shadowColour = 0xFFFFFFFF);
|
||||
wstring GetActionReplacement(int iPad, unsigned char ucAction);
|
||||
wstring GetVKReplacement(unsigned int uiVKey);
|
||||
wstring GetIconReplacement(unsigned int uiIcon);
|
||||
|
||||
float getAppTime() { return m_Time.fAppTime; }
|
||||
void UpdateTrialPausedTimer() { mfTrialPausedTime+= m_Time.fElapsedTime;}
|
||||
|
||||
static int RemoteSaveThreadProc( void* lpParameter );
|
||||
static void ExitGameFromRemoteSave( LPVOID lpParameter );
|
||||
static int ExitGameFromRemoteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||
private:
|
||||
UINT m_TipIDA[MAX_TIPS_GAMETIP+MAX_TIPS_TRIVIATIP];
|
||||
UINT m_uiCurrentTip;
|
||||
static int TipsSortFunction(const void* a, const void* b);
|
||||
|
||||
// XML
|
||||
public:
|
||||
|
||||
// Hold a vector of terrain feature positions
|
||||
void AddTerrainFeaturePosition(_eTerrainFeatureType,int,int);
|
||||
void ClearTerrainFeaturePosition();
|
||||
_eTerrainFeatureType IsTerrainFeature(int x,int z);
|
||||
bool GetTerrainFeaturePosition(_eTerrainFeatureType eType, int *pX, int *pZ);
|
||||
std::vector <FEATURE_DATA *> m_vTerrainFeatures;
|
||||
|
||||
static HRESULT RegisterMojangData(WCHAR *, PlayerUID, WCHAR *, WCHAR *);
|
||||
MOJANG_DATA *GetMojangDataForXuid(PlayerUID xuid);
|
||||
static HRESULT RegisterConfigValues(WCHAR *pType, int iValue);
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
HRESULT RegisterDLCData(char *pchDLCName, unsigned int uiSortIndex, char *pchImageURL);
|
||||
bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal);
|
||||
DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial);
|
||||
DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full);
|
||||
#elif defined(_XBOX_ONE)
|
||||
static HRESULT RegisterDLCData(eDLCContentType, WCHAR *, WCHAR *, WCHAR *, WCHAR *, int, unsigned int);
|
||||
//bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,WCHAR *pwchProductId);
|
||||
bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,wstring &wsProductId);
|
||||
DLC_INFO *GetDLCInfoForFullOfferID(WCHAR *pwchProductId);
|
||||
DLC_INFO *GetDLCInfoForProductName(WCHAR *pwchProductName);
|
||||
#else
|
||||
static HRESULT RegisterDLCData(WCHAR *, WCHAR *, int, __uint64, __uint64, WCHAR *, unsigned int, int, WCHAR *pDataFile);
|
||||
bool GetDLCFullOfferIDForSkinID(const wstring &FirstSkin,ULONGLONG *pullVal);
|
||||
DLC_INFO *GetDLCInfoForTrialOfferID(ULONGLONG ullOfferID_Trial);
|
||||
DLC_INFO *GetDLCInfoForFullOfferID(ULONGLONG ullOfferID_Full);
|
||||
#endif
|
||||
|
||||
unsigned int GetDLCCreditsCount();
|
||||
SCreditTextItemDef * GetDLCCredits(int iIndex);
|
||||
|
||||
// TMS
|
||||
void ReadDLCFileFromTMS(int iPad,eTMSAction action, bool bCallback=false);
|
||||
void ReadXuidsFileFromTMS(int iPad,eTMSAction action,bool bCallback=false);
|
||||
|
||||
// images for save thumbnail/social post
|
||||
virtual void CaptureSaveThumbnail() =0;
|
||||
virtual void GetSaveThumbnail(PBYTE*,DWORD*)=0;
|
||||
virtual void ReleaseSaveThumbnail()=0;
|
||||
virtual void GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize)=0;
|
||||
|
||||
virtual void ReadBannedList(int iPad, eTMSAction action=(eTMSAction)0, bool bCallback=false)=0;
|
||||
|
||||
private:
|
||||
|
||||
std::vector <SCreditTextItemDef *> vDLCCredits;
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__)
|
||||
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
|
||||
static unordered_map<int, char * > DLCTextures_PackID; // for mash-up packs & texture packs
|
||||
static unordered_map<string,DLC_INFO * > DLCInfo;
|
||||
static unordered_map<wstring, ULONGLONG > DLCInfo_SkinName; // skin name, full offer id
|
||||
#elif defined(_DURANGO)
|
||||
static unordered_map<PlayerUID,MOJANG_DATA *, PlayerUID::Hash > MojangData;
|
||||
static unordered_map<int, wstring > DLCTextures_PackID; // for mash-up packs & texture packs
|
||||
//static unordered_map<wstring,DLC_INFO * > DLCInfo_Trial; // full offerid, dlc_info
|
||||
static unordered_map<wstring,DLC_INFO * > DLCInfo_Full; // full offerid, dlc_info
|
||||
static unordered_map<wstring, wstring > DLCInfo_SkinName; // skin name, full offer id
|
||||
#else
|
||||
static unordered_map<PlayerUID,MOJANG_DATA * > MojangData;
|
||||
static unordered_map<int, ULONGLONG > DLCTextures_PackID; // for mash-up packs & texture packs
|
||||
static unordered_map<ULONGLONG,DLC_INFO * > DLCInfo_Trial; // full offerid, dlc_info
|
||||
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_bDefaultCapeInstallAttempted; // have we attempted to install the default cape from tms
|
||||
|
||||
//bool m_bwasHidingGui; // 4J Stu - Removed 1.8.2 bug fix (TU6) as not needed
|
||||
bool m_bDLCInstallProcessCompleted;
|
||||
bool m_bDLCInstallPending;
|
||||
int m_iTotalDLC;
|
||||
int m_iTotalDLCInstalled;
|
||||
|
||||
public:
|
||||
// 4J Stu - We need to be able to detect when a guest player signs in or out causing other guest players to change their xuid
|
||||
// The simplest way to do this is to check if their guest number has changed, so store the last known one here
|
||||
// 4J Stu - Now storing the whole XUSER_SIGNIN_INFO so we can detect xuid changes
|
||||
XUSER_SIGNIN_INFO m_currentSigninInfo[XUSER_MAX_COUNT];
|
||||
|
||||
//void OverrideFontRenderer(bool set, bool immediate = true);
|
||||
// void ToggleFontRenderer() { OverrideFontRenderer(!m_bFontRendererOverridden,false); }
|
||||
BANNEDLIST BannedListA[XUSER_MAX_COUNT];
|
||||
|
||||
private:
|
||||
// XUI_FontRenderer *m_fontRenderer;
|
||||
// bool m_bFontRendererOverridden;
|
||||
// bool m_bOverrideFontRenderer;
|
||||
|
||||
|
||||
bool m_bRead_BannedListA[XUSER_MAX_COUNT];
|
||||
char m_pszUniqueMapName[14];
|
||||
bool m_BanListCheck[XUSER_MAX_COUNT];
|
||||
|
||||
public:
|
||||
void SetBanListCheck(int iPad,bool bVal) {m_BanListCheck[iPad]=bVal;}
|
||||
bool GetBanListCheck(int iPad) { return m_BanListCheck[iPad];}
|
||||
// AUTOSAVE
|
||||
public:
|
||||
void SetAutosaveTimerTime(void);
|
||||
bool AutosaveDue(void);
|
||||
unsigned int SecondsToAutosave();
|
||||
private:
|
||||
unsigned int m_uiAutosaveTimer;
|
||||
unsigned int m_uiOpacityCountDown[XUSER_MAX_COUNT];
|
||||
|
||||
// DLC
|
||||
bool m_bNewDLCAvailable;
|
||||
bool m_bSeenNewDLCTip;
|
||||
|
||||
// Host options
|
||||
private:
|
||||
unsigned int m_uiGameHostSettings;
|
||||
static unsigned char m_szPNG[8];
|
||||
|
||||
unsigned int FromBigEndian(unsigned int uiValue);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
void SetGameHostOption(eGameHostOption eVal,unsigned int uiVal);
|
||||
void SetGameHostOption(unsigned int &uiHostSettings, eGameHostOption eVal,unsigned int uiVal);
|
||||
unsigned int GetGameHostOption(eGameHostOption eVal);
|
||||
unsigned int GetGameHostOption(unsigned int uiHostSettings, eGameHostOption eVal);
|
||||
|
||||
void SetResetNether(bool bResetNether) {m_bResetNether=bResetNether;}
|
||||
bool GetResetNether() {return m_bResetNether;}
|
||||
bool CanRecordStatsAndAchievements();
|
||||
|
||||
// World seed from png image
|
||||
void GetImageTextData(PBYTE pbImageData, DWORD dwImageBytes,unsigned char *pszSeed,unsigned int &uiHostOptions,bool &bHostOptionsRead,DWORD &uiTexturePack);
|
||||
unsigned int CreateImageTextData(PBYTE bTextMetadata, __int64 seed, bool hasSeed, unsigned int uiHostOptions, unsigned int uiTexturePackId);
|
||||
|
||||
// Game rules
|
||||
GameRuleManager m_gameRules;
|
||||
|
||||
public:
|
||||
void processSchematics(LevelChunk *levelChunk);
|
||||
void processSchematicsLighting(LevelChunk *levelChunk);
|
||||
void loadDefaultGameRules();
|
||||
vector<LevelGenerationOptions *> *getLevelGenerators() { return m_gameRules.getLevelGenerators(); }
|
||||
void setLevelGenerationOptions(LevelGenerationOptions *levelGen);
|
||||
LevelRuleset *getGameRuleDefinitions() { return m_gameRules.getGameRuleDefinitions(); }
|
||||
LevelGenerationOptions *getLevelGenerationOptions() { return m_gameRules.getLevelGenerationOptions(); }
|
||||
LPCWSTR GetGameRulesString(const wstring &key);
|
||||
|
||||
private:
|
||||
BYTE m_playerColours[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's
|
||||
unsigned int m_playerGamePrivileges[MINECRAFT_NET_MAX_PLAYERS];
|
||||
|
||||
public:
|
||||
void UpdatePlayerInfo(BYTE networkSmallId, SHORT playerColourIndex, unsigned int playerGamePrivileges);
|
||||
short GetPlayerColour(BYTE networkSmallId);
|
||||
unsigned int GetPlayerPrivileges(BYTE networkSmallId);
|
||||
|
||||
wstring getEntityName(eINSTANCEOF type);
|
||||
|
||||
|
||||
|
||||
unsigned int AddDLCRequest(eDLCMarketplaceType eContentType, bool bPromote=false);
|
||||
bool RetrieveNextDLCContent();
|
||||
bool CheckTMSDLCCanStop();
|
||||
static int DLCOffersReturned(void *pParam, int iOfferC, DWORD dwType, int iPad);
|
||||
DWORD GetDLCContentType(eDLCContentType eType) { return m_dwContentTypeA[eType];}
|
||||
eDLCContentType Find_eDLCContentType(DWORD dwType);
|
||||
int GetDLCOffersCount() { return m_iDLCOfferC;}
|
||||
bool DLCContentRetrieved(eDLCMarketplaceType eType);
|
||||
void TickDLCOffersRetrieved();
|
||||
void ClearAndResetDLCDownloadQueue();
|
||||
bool RetrieveNextTMSPPContent();
|
||||
void TickTMSPPFilesRetrieved();
|
||||
void ClearTMSPPFilesRetrieved();
|
||||
unsigned int AddTMSPPFileTypeRequest(eDLCContentType eType, bool bPromote=false);
|
||||
int GetDLCInfoTexturesOffersCount();
|
||||
#if defined( __PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
|
||||
DLC_INFO *GetDLCInfo(int iIndex);
|
||||
DLC_INFO *GetDLCInfo(char *);
|
||||
DLC_INFO *GetDLCInfoFromTPackID(int iTPID);
|
||||
bool GetDLCNameForPackID(const int iPackID,char **ppchKeyID);
|
||||
char * GetDLCInfoTextures(int iIndex);
|
||||
int GetDLCInfoCount();
|
||||
#else
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
static int TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,LPVOID, WCHAR *wchFilename);
|
||||
unordered_map<wstring,DLC_INFO * > *GetDLCInfo();
|
||||
#else
|
||||
static int TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JStorage::PTMSPP_FILEDATA pFileData, LPCSTR szFilename);
|
||||
#endif
|
||||
DLC_INFO *GetDLCInfoTrialOffer(int iIndex);
|
||||
DLC_INFO *GetDLCInfoFullOffer(int iIndex);
|
||||
|
||||
int GetDLCInfoTrialOffersCount();
|
||||
int GetDLCInfoFullOffersCount();
|
||||
#ifdef _XBOX_ONE
|
||||
bool GetDLCFullOfferIDForPackID(const int iPackID,wstring &wsProductId);
|
||||
wstring GetDLCInfoTexturesFullOffer(int iIndex);
|
||||
|
||||
#else
|
||||
bool GetDLCFullOfferIDForPackID(const int iPackID,ULONGLONG *pullVal);
|
||||
ULONGLONG GetDLCInfoTexturesFullOffer(int iIndex);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void SetCorruptSaveDeleted(bool bVal) {m_bCorruptSaveDeleted=bVal;}
|
||||
bool GetCorruptSaveDeleted(void) {return m_bCorruptSaveDeleted;}
|
||||
|
||||
void EnterSaveNotificationSection();
|
||||
void LeaveSaveNotificationSection();
|
||||
private:
|
||||
CRITICAL_SECTION m_saveNotificationCriticalSection;
|
||||
int m_saveNotificationDepth;
|
||||
// Download Status
|
||||
|
||||
//Request current_download;
|
||||
vector<DLCRequest *> m_DLCDownloadQueue;
|
||||
vector<TMSPPRequest *> m_TMSPPDownloadQueue;
|
||||
static DWORD m_dwContentTypeA[e_Marketplace_MAX];
|
||||
int m_iDLCOfferC;
|
||||
bool m_bAllDLCContentRetrieved;
|
||||
bool m_bAllTMSContentRetrieved;
|
||||
bool m_bTickTMSDLCFiles;
|
||||
CRITICAL_SECTION csDLCDownloadQueue;
|
||||
CRITICAL_SECTION csTMSPPDownloadQueue;
|
||||
CRITICAL_SECTION csAdditionalModelParts;
|
||||
CRITICAL_SECTION csAdditionalSkinBoxes;
|
||||
CRITICAL_SECTION csAnimOverrideBitmask;
|
||||
bool m_bCorruptSaveDeleted;
|
||||
|
||||
DWORD m_dwAdditionalModelParts[XUSER_MAX_COUNT];
|
||||
|
||||
BYTE *m_pBannedListFileBuffer;
|
||||
DWORD m_dwBannedListFileSize;
|
||||
|
||||
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);
|
||||
|
||||
// Storing additional model parts per skin texture
|
||||
void SetAdditionalSkinBoxes(DWORD dwSkinID, SKIN_BOX *SkinBoxA, DWORD dwSkinBoxC);
|
||||
vector<ModelPart *> * SetAdditionalSkinBoxes(DWORD dwSkinID, vector<SKIN_BOX *> *pvSkinBoxA);
|
||||
vector<ModelPart *> *GetAdditionalModelParts(DWORD dwSkinID);
|
||||
vector<SKIN_BOX *> *GetAdditionalSkinBoxes(DWORD dwSkinID);
|
||||
void SetAnimOverrideBitmask(DWORD dwSkinID,unsigned int uiAnimOverrideBitmask);
|
||||
unsigned int GetAnimOverrideBitmask(DWORD dwSkinID);
|
||||
|
||||
static DWORD getSkinIdFromPath(const wstring &skin);
|
||||
static wstring getSkinPathFromId(DWORD skinId);
|
||||
|
||||
virtual int LoadLocalTMSFile(WCHAR *wchTMSFile)=0;
|
||||
virtual int LoadLocalTMSFile(WCHAR *wchTMSFile, eFileExtensionType eExt)=0;
|
||||
virtual void FreeLocalTMSFiles(eTMSFileType eType)=0;
|
||||
virtual int GetLocalTMSFileIndex(WCHAR *wchTMSFile,bool bFilenameIncludesExtension,eFileExtensionType eEXT)=0;
|
||||
|
||||
virtual bool GetTMSGlobalFileListRead() { return true;}
|
||||
virtual bool GetTMSDLCInfoRead() { return true;}
|
||||
virtual bool GetTMSXUIDsFileRead() { return true;}
|
||||
|
||||
bool GetBanListRead(int iPad) { return m_bRead_BannedListA[iPad];}
|
||||
void SetBanListRead(int iPad,bool bVal) { m_bRead_BannedListA[iPad]=bVal;}
|
||||
void ClearBanList(int iPad) { BannedListA[iPad].pBannedList=NULL;BannedListA[iPad].dwBytes=0;}
|
||||
|
||||
DWORD GetRequiredTexturePackID() {return m_dwRequiredTexturePackID;}
|
||||
void SetRequiredTexturePackID(DWORD dwID) {m_dwRequiredTexturePackID=dwID;}
|
||||
|
||||
virtual void GetFileFromTPD(eTPDFileType eType,PBYTE pbData,DWORD dwBytes,PBYTE *ppbData,DWORD *pdwBytes ) {*ppbData = NULL; *pdwBytes = 0;}
|
||||
|
||||
//XTITLE_DEPLOYMENT_TYPE getDeploymentType() { return m_titleDeploymentType; }
|
||||
|
||||
private:
|
||||
// vector of additional skin model parts, indexed by the skin texture id
|
||||
unordered_map<DWORD, vector<ModelPart *> *> m_AdditionalModelParts;
|
||||
unordered_map<DWORD, vector<SKIN_BOX *> *> m_AdditionalSkinBoxes;
|
||||
unordered_map<DWORD, unsigned int> m_AnimOverrides;
|
||||
|
||||
|
||||
bool m_bResetNether;
|
||||
DWORD m_dwRequiredTexturePackID;
|
||||
#ifdef _XBOX_ONE
|
||||
vector <PBYTE> m_vTMSPPData;
|
||||
#endif
|
||||
|
||||
#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
|
||||
C4JStorage::eOptionsCallback m_eOptionsStatusA[XUSER_MAX_COUNT];
|
||||
|
||||
#ifdef __ORBIS__
|
||||
int m_eOptionsBlocksRequiredA[XUSER_MAX_COUNT];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// 4J-PB - language and locale functions
|
||||
public:
|
||||
|
||||
void LocaleAndLanguageInit();
|
||||
void getLocale(vector<wstring> &vecWstrLocales);
|
||||
DWORD get_eMCLang(WCHAR *pwchLocale);
|
||||
DWORD get_xcLang(WCHAR *pwchLocale);
|
||||
|
||||
void SetTickTMSDLCFiles(bool bVal);
|
||||
|
||||
wstring getFilePath(DWORD packId, wstring filename, bool bAddDataFolder);
|
||||
|
||||
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);
|
||||
public:
|
||||
|
||||
#ifdef _XBOX
|
||||
// bool m_bTransferSavesToXboxOne;
|
||||
// unsigned int m_uiTransferSlotC;
|
||||
|
||||
#elif defined (__PS3__)
|
||||
|
||||
#elif defined _DURANGO
|
||||
|
||||
#elif defined _WINDOWS64
|
||||
//CMinecraftAudio audio;
|
||||
#else // PS4
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
public:
|
||||
void SetReachedMainMenu();
|
||||
bool HasReachedMainMenu();
|
||||
private:
|
||||
bool m_hasReachedMainMenu;
|
||||
#endif
|
||||
};
|
||||
|
||||
//singleton
|
||||
//extern CMinecraftApp app;
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.enchantment.h"
|
||||
#include "AddEnchantmentRuleDefinition.h"
|
||||
|
||||
AddEnchantmentRuleDefinition::AddEnchantmentRuleDefinition()
|
||||
{
|
||||
m_enchantmentId = m_enchantmentLevel = 0;
|
||||
}
|
||||
|
||||
void AddEnchantmentRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 2);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentId);
|
||||
dos->writeUTF( _toString( m_enchantmentId ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_enchantmentLevel);
|
||||
dos->writeUTF( _toString( m_enchantmentLevel ) );
|
||||
}
|
||||
|
||||
void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
{
|
||||
if(attributeName.compare(L"enchantmentId") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
if(value < 0) value = 0;
|
||||
if(value >= 256) value = 255;
|
||||
m_enchantmentId = value;
|
||||
app.DebugPrintf("AddEnchantmentRuleDefinition: Adding parameter enchantmentId=%d\n",m_enchantmentId);
|
||||
}
|
||||
else if(attributeName.compare(L"enchantmentLevel") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
if(value < 0) value = 0;
|
||||
m_enchantmentLevel = value;
|
||||
app.DebugPrintf("AddEnchantmentRuleDefinition: Adding parameter enchantmentLevel=%d\n",m_enchantmentLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRuleDefinition::addAttribute(attributeName, attributeValue);
|
||||
}
|
||||
}
|
||||
|
||||
bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool enchanted = false;
|
||||
if (item != NULL)
|
||||
{
|
||||
// 4J-JEV: Ripped code from enchantmenthelpers
|
||||
// Maybe we want to add an addEnchantment method to EnchantmentHelpers
|
||||
if (item->id == Item::enchantedBook_Id)
|
||||
{
|
||||
Item::enchantedBook->addEnchantment( item, new EnchantmentInstance(m_enchantmentId, m_enchantmentLevel) );
|
||||
}
|
||||
else if (item->isEnchantable())
|
||||
{
|
||||
Enchantment *e = Enchantment::enchantments[m_enchantmentId];
|
||||
|
||||
if(e != NULL && e->category->canEnchant(item->getItem()))
|
||||
{
|
||||
int level = min(e->getMaxLevel(), m_enchantmentLevel);
|
||||
item->enchant(e, m_enchantmentLevel);
|
||||
enchanted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return enchanted;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include "GameRuleDefinition.h"
|
||||
|
||||
class ItemInstance;
|
||||
|
||||
class AddEnchantmentRuleDefinition : public GameRuleDefinition
|
||||
{
|
||||
private:
|
||||
int m_enchantmentId;
|
||||
int m_enchantmentLevel;
|
||||
|
||||
public:
|
||||
AddEnchantmentRuleDefinition();
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddEnchantment; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *, UINT numAttrs);
|
||||
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
bool enchantItem(shared_ptr<ItemInstance> item);
|
||||
};
|
||||
127
Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp
Normal file
127
Minecraft.Client/Common/GameRules/AddItemRuleDefinition.cpp
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.player.h"
|
||||
#include "AddItemRuleDefinition.h"
|
||||
#include "AddEnchantmentRuleDefinition.h"
|
||||
|
||||
AddItemRuleDefinition::AddItemRuleDefinition()
|
||||
{
|
||||
m_itemId = m_quantity = m_auxValue = m_dataTag = 0;
|
||||
m_slot = -1;
|
||||
}
|
||||
|
||||
void AddItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
|
||||
dos->writeUTF( _toString( m_itemId ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
|
||||
dos->writeUTF( _toString( m_quantity ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
|
||||
dos->writeUTF( _toString( m_auxValue ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
|
||||
dos->writeUTF( _toString( m_dataTag ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_slot);
|
||||
dos->writeUTF( _toString( m_slot ) );
|
||||
}
|
||||
|
||||
void AddItemRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
GameRuleDefinition::getChildren( children );
|
||||
for (AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); it++)
|
||||
children->push_back( *it );
|
||||
}
|
||||
|
||||
GameRuleDefinition *AddItemRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_AddEnchantment)
|
||||
{
|
||||
rule = new AddEnchantmentRuleDefinition();
|
||||
m_enchantments.push_back((AddEnchantmentRuleDefinition *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
//wprintf(L"AddItemRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
|
||||
#endif
|
||||
}
|
||||
return rule;
|
||||
}
|
||||
|
||||
void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
{
|
||||
if(attributeName.compare(L"itemId") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_itemId = value;
|
||||
//app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter itemId=%d\n",m_itemId);
|
||||
}
|
||||
else if(attributeName.compare(L"quantity") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_quantity = value;
|
||||
//app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter quantity=%d\n",m_quantity);
|
||||
}
|
||||
else if(attributeName.compare(L"auxValue") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_auxValue = value;
|
||||
//app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter auxValue=%d\n",m_auxValue);
|
||||
}
|
||||
else if(attributeName.compare(L"dataTag") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_dataTag = value;
|
||||
//app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter dataTag=%d\n",m_dataTag);
|
||||
}
|
||||
else if(attributeName.compare(L"slot") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_slot = value;
|
||||
//app.DebugPrintf(2,"AddItemRuleDefinition: Adding parameter slot=%d\n",m_slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRuleDefinition::addAttribute(attributeName, attributeValue);
|
||||
}
|
||||
}
|
||||
|
||||
bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container, int slotId)
|
||||
{
|
||||
bool added = false;
|
||||
if(Item::items[m_itemId] != NULL)
|
||||
{
|
||||
int quantity = min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
||||
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
||||
newItem->set4JData(m_dataTag);
|
||||
|
||||
for(AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it)
|
||||
{
|
||||
(*it)->enchantItem(newItem);
|
||||
}
|
||||
|
||||
if(m_slot >= 0 && m_slot < container->getContainerSize() )
|
||||
{
|
||||
container->setItem( m_slot, newItem );
|
||||
added = true;
|
||||
}
|
||||
else if(slotId >= 0 && slotId < container->getContainerSize() )
|
||||
{
|
||||
container->setItem( slotId, newItem );
|
||||
added = true;
|
||||
}
|
||||
else if(dynamic_pointer_cast<Inventory>(container) != NULL)
|
||||
{
|
||||
added = dynamic_pointer_cast<Inventory>(container)->add(newItem);
|
||||
}
|
||||
}
|
||||
return added;
|
||||
}
|
||||
30
Minecraft.Client/Common/GameRules/AddItemRuleDefinition.h
Normal file
30
Minecraft.Client/Common/GameRules/AddItemRuleDefinition.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include "GameRuleDefinition.h"
|
||||
|
||||
class Container;
|
||||
class AddEnchantmentRuleDefinition;
|
||||
|
||||
class AddItemRuleDefinition : public GameRuleDefinition
|
||||
{
|
||||
private:
|
||||
int m_itemId;
|
||||
int m_quantity;
|
||||
int m_auxValue;
|
||||
int m_dataTag;
|
||||
int m_slot;
|
||||
vector<AddEnchantmentRuleDefinition *> m_enchantments;
|
||||
|
||||
public:
|
||||
AddItemRuleDefinition();
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *, UINT numAttributes);
|
||||
virtual void getChildren(vector<GameRuleDefinition *> *children);
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_AddItem; }
|
||||
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
bool addItemToContainer(shared_ptr<Container> container, int slotId);
|
||||
};
|
||||
|
|
@ -0,0 +1,249 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.phys.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.dimension.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.chunk.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
|
||||
#include "ApplySchematicRuleDefinition.h"
|
||||
#include "LevelGenerationOptions.h"
|
||||
#include "ConsoleSchematicFile.h"
|
||||
|
||||
ApplySchematicRuleDefinition::ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions)
|
||||
{
|
||||
m_levelGenOptions = levelGenOptions;
|
||||
m_location = Vec3::newPermanent(0,0,0);
|
||||
m_locationBox = NULL;
|
||||
m_totalBlocksChanged = 0;
|
||||
m_totalBlocksChangedLighting = 0;
|
||||
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
||||
m_completed = false;
|
||||
m_dimension = 0;
|
||||
m_schematic = NULL;
|
||||
}
|
||||
|
||||
ApplySchematicRuleDefinition::~ApplySchematicRuleDefinition()
|
||||
{
|
||||
app.DebugPrintf("Deleting ApplySchematicRuleDefinition.\n");
|
||||
if(!m_completed) m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||
m_schematic = NULL;
|
||||
delete m_location;
|
||||
}
|
||||
|
||||
void ApplySchematicRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_filename);
|
||||
dos->writeUTF(m_schematicName);
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||
dos->writeUTF(_toString(m_location->x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||
dos->writeUTF(_toString(m_location->y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||
dos->writeUTF(_toString(m_location->z));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_rot);
|
||||
|
||||
switch (m_rotation)
|
||||
{
|
||||
case ConsoleSchematicFile::eSchematicRot_0: dos->writeUTF(_toString( 0 )); break;
|
||||
case ConsoleSchematicFile::eSchematicRot_90: dos->writeUTF(_toString( 90 )); break;
|
||||
case ConsoleSchematicFile::eSchematicRot_180: dos->writeUTF(_toString( 180 )); break;
|
||||
case ConsoleSchematicFile::eSchematicRot_270: dos->writeUTF(_toString( 270 )); break;
|
||||
}
|
||||
}
|
||||
|
||||
void ApplySchematicRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
{
|
||||
if(attributeName.compare(L"filename") == 0)
|
||||
{
|
||||
m_schematicName = attributeValue;
|
||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter filename=%s\n",m_schematicName.c_str());
|
||||
|
||||
if(!m_schematicName.empty())
|
||||
{
|
||||
if(m_schematicName.substr( m_schematicName.length() - 4, m_schematicName.length()).compare(L".sch") != 0)
|
||||
{
|
||||
m_schematicName.append(L".sch");
|
||||
}
|
||||
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
}
|
||||
}
|
||||
else if(attributeName.compare(L"x") == 0)
|
||||
{
|
||||
m_location->x = _fromString<int>(attributeValue);
|
||||
if( ((int)abs(m_location->x))%2 != 0) m_location->x -=1;
|
||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter x=%f\n",m_location->x);
|
||||
}
|
||||
else if(attributeName.compare(L"y") == 0)
|
||||
{
|
||||
m_location->y = _fromString<int>(attributeValue);
|
||||
if( ((int)abs(m_location->y))%2 != 0) m_location->y -= 1;
|
||||
if(m_location->y < 0) m_location->y = 0;
|
||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter y=%f\n",m_location->y);
|
||||
}
|
||||
else if(attributeName.compare(L"z") == 0)
|
||||
{
|
||||
m_location->z = _fromString<int>(attributeValue);
|
||||
if(((int)abs(m_location->z))%2 != 0) m_location->z -= 1;
|
||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter z=%f\n",m_location->z);
|
||||
}
|
||||
else if(attributeName.compare(L"rot") == 0)
|
||||
{
|
||||
int degrees = _fromString<int>(attributeValue);
|
||||
|
||||
while(degrees < 0) degrees += 360;
|
||||
while(degrees >= 360) degrees -= 360;
|
||||
float quad = degrees/90;
|
||||
degrees = (int)(quad + 0.5f);
|
||||
switch(degrees)
|
||||
{
|
||||
case 1:
|
||||
m_rotation = ConsoleSchematicFile::eSchematicRot_90;
|
||||
break;
|
||||
case 2:
|
||||
m_rotation = ConsoleSchematicFile::eSchematicRot_180;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
m_rotation = ConsoleSchematicFile::eSchematicRot_270;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
m_rotation = ConsoleSchematicFile::eSchematicRot_0;
|
||||
break;
|
||||
};
|
||||
|
||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter rot=%d\n",m_rotation);
|
||||
}
|
||||
else if(attributeName.compare(L"dim") == 0)
|
||||
{
|
||||
m_dimension = _fromString<int>(attributeValue);
|
||||
if(m_dimension > 1 || m_dimension < -1) m_dimension = 0;
|
||||
//app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter dimension=%d\n",m_dimension);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRuleDefinition::addAttribute(attributeName, attributeValue);
|
||||
}
|
||||
}
|
||||
|
||||
void ApplySchematicRuleDefinition::updateLocationBox()
|
||||
{
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
m_locationBox = AABB::newPermanent(0,0,0,0,0,0);
|
||||
|
||||
m_locationBox->x0 = m_location->x;
|
||||
m_locationBox->y0 = m_location->y;
|
||||
m_locationBox->z0 = m_location->z;
|
||||
|
||||
m_locationBox->y1 = m_location->y + m_schematic->getYSize();
|
||||
|
||||
switch(m_rotation)
|
||||
{
|
||||
case ConsoleSchematicFile::eSchematicRot_90:
|
||||
case ConsoleSchematicFile::eSchematicRot_270:
|
||||
m_locationBox->x1 = m_location->x + m_schematic->getZSize();
|
||||
m_locationBox->z1 = m_location->z + m_schematic->getXSize();
|
||||
break;
|
||||
case ConsoleSchematicFile::eSchematicRot_0:
|
||||
case ConsoleSchematicFile::eSchematicRot_180:
|
||||
default:
|
||||
m_locationBox->x1 = m_location->x + m_schematic->getXSize();
|
||||
m_locationBox->z1 = m_location->z + m_schematic->getZSize();
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
void ApplySchematicRuleDefinition::processSchematic(AABB *chunkBox, LevelChunk *chunk)
|
||||
{
|
||||
if( m_completed ) return;
|
||||
if(chunk->level->dimension->id != m_dimension) return;
|
||||
|
||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition");
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
if(m_locationBox == NULL) updateLocationBox();
|
||||
if(chunkBox->intersects( m_locationBox ))
|
||||
{
|
||||
m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 );
|
||||
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",m_schematicName.c_str(),chunk->x, chunk->z);
|
||||
#endif
|
||||
PIXBeginNamedEvent(0,"Applying blocks and data");
|
||||
m_totalBlocksChanged += m_schematic->applyBlocksAndData(chunk, chunkBox, m_locationBox, m_rotation);
|
||||
PIXEndNamedEvent();
|
||||
|
||||
// Add the tileEntities
|
||||
PIXBeginNamedEvent(0,"Applying tile entities");
|
||||
m_schematic->applyTileEntities(chunk, chunkBox, m_locationBox, m_rotation);
|
||||
PIXEndNamedEvent();
|
||||
|
||||
// TODO This does not take into account things that go outside the bounds of the world
|
||||
int targetBlocks = (m_locationBox->x1 - m_locationBox->x0)
|
||||
* (m_locationBox->y1 - m_locationBox->y0)
|
||||
* (m_locationBox->z1 - m_locationBox->z0);
|
||||
if( (m_totalBlocksChanged == targetBlocks) && (m_totalBlocksChangedLighting == targetBlocks) )
|
||||
{
|
||||
m_completed = true;
|
||||
//m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||
//m_schematic = NULL;
|
||||
}
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
}
|
||||
|
||||
void ApplySchematicRuleDefinition::processSchematicLighting(AABB *chunkBox, LevelChunk *chunk)
|
||||
{
|
||||
if( m_completed ) return;
|
||||
if(chunk->level->dimension->id != m_dimension) return;
|
||||
|
||||
PIXBeginNamedEvent(0, "Processing ApplySchematicRuleDefinition (lighting)");
|
||||
if(m_schematic == NULL) m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
|
||||
|
||||
if(m_locationBox == NULL) updateLocationBox();
|
||||
if(chunkBox->intersects( m_locationBox ))
|
||||
{
|
||||
m_locationBox->y1 = min((double)Level::maxBuildHeight, m_locationBox->y1 );
|
||||
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("Applying schematic %ls to chunk (%d,%d)\n",m_schematicName.c_str(),chunk->x, chunk->z);
|
||||
#endif
|
||||
PIXBeginNamedEvent(0,"Patching lighting");
|
||||
m_totalBlocksChangedLighting += m_schematic->applyLighting(chunk, chunkBox, m_locationBox, m_rotation);
|
||||
PIXEndNamedEvent();
|
||||
|
||||
// TODO This does not take into account things that go outside the bounds of the world
|
||||
int targetBlocks = (m_locationBox->x1 - m_locationBox->x0)
|
||||
* (m_locationBox->y1 - m_locationBox->y0)
|
||||
* (m_locationBox->z1 - m_locationBox->z0);
|
||||
if( (m_totalBlocksChanged == targetBlocks) && (m_totalBlocksChangedLighting == targetBlocks) )
|
||||
{
|
||||
m_completed = true;
|
||||
//m_levelGenOptions->releaseSchematicFile(m_schematicName);
|
||||
//m_schematic = NULL;
|
||||
}
|
||||
}
|
||||
PIXEndNamedEvent();
|
||||
}
|
||||
|
||||
bool ApplySchematicRuleDefinition::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1)
|
||||
{
|
||||
if( m_locationBox == NULL ) updateLocationBox();
|
||||
return m_locationBox->intersects(x0,y0,z0,x1,y1,z1);
|
||||
}
|
||||
|
||||
int ApplySchematicRuleDefinition::getMinY()
|
||||
{
|
||||
if( m_locationBox == NULL ) updateLocationBox();
|
||||
return m_locationBox->y0;
|
||||
}
|
||||
|
||||
void ApplySchematicRuleDefinition::reset()
|
||||
{
|
||||
m_totalBlocksChanged = 0;
|
||||
m_totalBlocksChangedLighting = 0;
|
||||
m_completed = false;
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
#pragma once
|
||||
#include "GameRuleDefinition.h"
|
||||
#include "ConsoleSchematicFile.h"
|
||||
|
||||
class AABB;
|
||||
class Vec3;
|
||||
class LevelChunk;
|
||||
class LevelGenerationOptions;
|
||||
class GRFObject;
|
||||
|
||||
class ApplySchematicRuleDefinition : public GameRuleDefinition
|
||||
{
|
||||
private:
|
||||
LevelGenerationOptions *m_levelGenOptions;
|
||||
wstring m_schematicName;
|
||||
ConsoleSchematicFile *m_schematic;
|
||||
Vec3 *m_location;
|
||||
AABB *m_locationBox;
|
||||
ConsoleSchematicFile::ESchematicRotation m_rotation;
|
||||
int m_dimension;
|
||||
|
||||
__int64 m_totalBlocksChanged;
|
||||
__int64 m_totalBlocksChangedLighting;
|
||||
bool m_completed;
|
||||
|
||||
void updateLocationBox();
|
||||
public:
|
||||
ApplySchematicRuleDefinition(LevelGenerationOptions *levelGenOptions);
|
||||
~ApplySchematicRuleDefinition();
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_ApplySchematic; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
void processSchematic(AABB *chunkBox, LevelChunk *chunk);
|
||||
void processSchematicLighting(AABB *chunkBox, LevelChunk *chunk);
|
||||
|
||||
bool checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1);
|
||||
int getMinY();
|
||||
|
||||
bool isComplete() { return m_completed; }
|
||||
|
||||
wstring getSchematicName() { return m_schematicName; }
|
||||
|
||||
/** 4J-JEV:
|
||||
* This GameRuleDefinition contains limited game state.
|
||||
* Reset any state to how it should be before a new game.
|
||||
*/
|
||||
void reset();
|
||||
};
|
||||
59
Minecraft.Client/Common/GameRules/BiomeOverride.cpp
Normal file
59
Minecraft.Client/Common/GameRules/BiomeOverride.cpp
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "BiomeOverride.h"
|
||||
|
||||
BiomeOverride::BiomeOverride()
|
||||
{
|
||||
m_tile = 0;
|
||||
m_topTile = 0;
|
||||
m_biomeId = 0;
|
||||
}
|
||||
|
||||
void BiomeOverride::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 3);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_biomeId);
|
||||
dos->writeUTF(_toString(m_biomeId));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_tileId);
|
||||
dos->writeUTF(_toString(m_tile));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_topTileId);
|
||||
dos->writeUTF(_toString(m_topTile));
|
||||
}
|
||||
|
||||
void BiomeOverride::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
{
|
||||
if(attributeName.compare(L"tileId") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_tile = value;
|
||||
app.DebugPrintf("BiomeOverride: Adding parameter tileId=%d\n",m_tile);
|
||||
}
|
||||
else if(attributeName.compare(L"topTileId") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_topTile = value;
|
||||
app.DebugPrintf("BiomeOverride: Adding parameter topTileId=%d\n",m_topTile);
|
||||
}
|
||||
else if(attributeName.compare(L"biomeId") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_biomeId = value;
|
||||
app.DebugPrintf("BiomeOverride: Adding parameter biomeId=%d\n",m_biomeId);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRuleDefinition::addAttribute(attributeName, attributeValue);
|
||||
}
|
||||
}
|
||||
|
||||
bool BiomeOverride::isBiome(int id)
|
||||
{
|
||||
return m_biomeId == id;
|
||||
}
|
||||
|
||||
void BiomeOverride::getTileValues(BYTE &tile, BYTE &topTile)
|
||||
{
|
||||
if(m_tile != 0) tile = (BYTE)m_tile;
|
||||
if(m_topTile != 0) topTile = (BYTE)m_topTile;
|
||||
}
|
||||
23
Minecraft.Client/Common/GameRules/BiomeOverride.h
Normal file
23
Minecraft.Client/Common/GameRules/BiomeOverride.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
#include "GameRuleDefinition.h"
|
||||
|
||||
class BiomeOverride : public GameRuleDefinition
|
||||
{
|
||||
private:
|
||||
BYTE m_topTile;
|
||||
BYTE m_tile;
|
||||
int m_biomeId;
|
||||
|
||||
public:
|
||||
BiomeOverride();
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_BiomeOverride; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
bool isBiome(int id);
|
||||
void getTileValues(BYTE &tile, BYTE &topTile);
|
||||
};
|
||||
117
Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp
Normal file
117
Minecraft.Client/Common/GameRules/CollectItemRuleDefinition.cpp
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\..\WstringLookup.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "CollectItemRuleDefinition.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||
#include "..\..\..\Minecraft.World\Connection.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
|
||||
|
||||
CollectItemRuleDefinition::CollectItemRuleDefinition()
|
||||
{
|
||||
m_itemId = 0;
|
||||
m_auxValue = 0;
|
||||
m_quantity = 0;
|
||||
}
|
||||
|
||||
CollectItemRuleDefinition::~CollectItemRuleDefinition()
|
||||
{
|
||||
}
|
||||
|
||||
void CollectItemRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttributes + 3);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_itemId);
|
||||
dos->writeUTF( _toString( m_itemId ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_auxValue);
|
||||
dos->writeUTF( _toString( m_auxValue ) );
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_quantity);
|
||||
dos->writeUTF( _toString( m_quantity ) );
|
||||
}
|
||||
|
||||
void CollectItemRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
{
|
||||
if(attributeName.compare(L"itemId") == 0)
|
||||
{
|
||||
m_itemId = _fromString<int>(attributeValue);
|
||||
app.DebugPrintf("CollectItemRule: Adding parameter itemId=%d\n",m_itemId);
|
||||
}
|
||||
else if(attributeName.compare(L"auxValue") == 0)
|
||||
{
|
||||
m_auxValue = _fromString<int>(attributeValue);
|
||||
app.DebugPrintf("CollectItemRule: Adding parameter m_auxValue=%d\n",m_auxValue);
|
||||
}
|
||||
else if(attributeName.compare(L"quantity") == 0)
|
||||
{
|
||||
m_quantity = _fromString<int>(attributeValue);
|
||||
app.DebugPrintf("CollectItemRule: Adding parameter m_quantity=%d\n",m_quantity);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRuleDefinition::addAttribute(attributeName, attributeValue);
|
||||
}
|
||||
}
|
||||
|
||||
int CollectItemRuleDefinition::getGoal()
|
||||
{
|
||||
return m_quantity;
|
||||
}
|
||||
|
||||
int CollectItemRuleDefinition::getProgress(GameRule *rule)
|
||||
{
|
||||
GameRule::ValueType value = rule->getParameter(L"iQuantity");
|
||||
return value.i;
|
||||
}
|
||||
|
||||
void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule)
|
||||
{
|
||||
GameRule::ValueType value;
|
||||
value.i = 0;
|
||||
rule->setParameter(L"iQuantity",value);
|
||||
|
||||
GameRuleDefinition::populateGameRule(type, rule);
|
||||
}
|
||||
|
||||
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
|
||||
{
|
||||
if(!getComplete(rule))
|
||||
{
|
||||
GameRule::ValueType value = rule->getParameter(L"iQuantity");
|
||||
int quantityCollected = (value.i += item->count);
|
||||
rule->setParameter(L"iQuantity",value);
|
||||
|
||||
statusChanged = true;
|
||||
|
||||
if(quantityCollected >= m_quantity)
|
||||
{
|
||||
setComplete(rule, true);
|
||||
app.DebugPrintf("Completed CollectItemRule with info - itemId:%d, auxValue:%d, quantity:%d, dataTag:%d\n", m_itemId,m_auxValue,m_quantity,m_4JDataValue);
|
||||
|
||||
if(rule->getConnection() != NULL)
|
||||
{
|
||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return statusChanged;
|
||||
}
|
||||
|
||||
wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
|
||||
{
|
||||
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
|
||||
wstring xml = L"";
|
||||
if(item != NULL)
|
||||
{
|
||||
xml = L"<CollectItemRule itemId=\"" + _toString<int>(item->id) + L"\" quantity=\"SET\" descriptionName=\"OPTIONAL\" promptName=\"OPTIONAL\"";
|
||||
if(item->getAuxValue() != 0) xml += L" auxValue=\"" + _toString<int>(item->getAuxValue()) + L"\"";
|
||||
if(item->get4JData() != 0) xml += L" dataTag=\"" + _toString<int>(item->get4JData()) + L"\"";
|
||||
xml += L"/>\n";
|
||||
}
|
||||
return xml;
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#pragma once
|
||||
|
||||
#include "GameRuleDefinition.h"
|
||||
|
||||
class Pos;
|
||||
class UseTileRuleDefinition;
|
||||
class ItemInstance;
|
||||
|
||||
class CollectItemRuleDefinition : public GameRuleDefinition
|
||||
{
|
||||
private:
|
||||
// These values should map directly to the xsd definition for this Rule
|
||||
int m_itemId;
|
||||
unsigned char m_auxValue;
|
||||
int m_quantity;
|
||||
|
||||
public:
|
||||
CollectItemRuleDefinition();
|
||||
~CollectItemRuleDefinition();
|
||||
|
||||
ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_CollectItemRule; }
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *, UINT numAttributes);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
virtual int getGoal();
|
||||
virtual int getProgress(GameRule *rule);
|
||||
|
||||
virtual int getIcon() { return m_itemId; }
|
||||
virtual int getAuxValue() { return m_auxValue; }
|
||||
|
||||
void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
|
||||
|
||||
bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item);
|
||||
|
||||
static wstring generateXml(shared_ptr<ItemInstance> item);
|
||||
|
||||
private:
|
||||
//static wstring generateXml(CollectItemRuleDefinition *ruleDef);
|
||||
};
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
#include "stdafx.h"
|
||||
#include "CompleteAllRuleDefinition.h"
|
||||
#include "ConsoleGameRules.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\..\Minecraft.World\Connection.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
|
||||
|
||||
void CompleteAllRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
CompoundGameRuleDefinition::getChildren(children);
|
||||
}
|
||||
|
||||
bool CompleteAllRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z)
|
||||
{
|
||||
bool statusChanged = CompoundGameRuleDefinition::onUseTile(rule,tileId,x,y,z);
|
||||
if(statusChanged) updateStatus(rule);
|
||||
return statusChanged;
|
||||
}
|
||||
|
||||
bool CompleteAllRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool statusChanged = CompoundGameRuleDefinition::onCollectItem(rule,item);
|
||||
if(statusChanged) updateStatus(rule);
|
||||
return statusChanged;
|
||||
}
|
||||
|
||||
void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
||||
{
|
||||
int goal = 0;
|
||||
int progress = 0;
|
||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
||||
{
|
||||
if(it->second.isPointer)
|
||||
{
|
||||
goal += it->second.gr->getGameRuleDefinition()->getGoal();
|
||||
progress += it->second.gr->getGameRuleDefinition()->getProgress(it->second.gr);
|
||||
}
|
||||
}
|
||||
if(rule->getConnection() != NULL)
|
||||
{
|
||||
PacketData data;
|
||||
data.goal = goal;
|
||||
data.progress = progress;
|
||||
|
||||
int icon = -1;
|
||||
int auxValue = 0;
|
||||
|
||||
if(m_lastRuleStatusChanged != NULL)
|
||||
{
|
||||
icon = m_lastRuleStatusChanged->getIcon();
|
||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||
m_lastRuleStatusChanged = NULL;
|
||||
}
|
||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData))));
|
||||
}
|
||||
app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal);
|
||||
}
|
||||
|
||||
wstring CompleteAllRuleDefinition::generateDescriptionString(const wstring &description, void *data, int dataLength)
|
||||
{
|
||||
PacketData *values = (PacketData *)data;
|
||||
wstring newDesc = description;
|
||||
newDesc = replaceAll(newDesc,L"{*progress*}",_toString<int>(values->progress));
|
||||
newDesc = replaceAll(newDesc,L"{*goal*}",_toString<int>(values->goal));
|
||||
return newDesc;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include "CompoundGameRuleDefinition.h"
|
||||
|
||||
class CompleteAllRuleDefinition : public CompoundGameRuleDefinition
|
||||
{
|
||||
private:
|
||||
typedef struct _packetData
|
||||
{
|
||||
int goal;
|
||||
int progress;
|
||||
} PacketData;
|
||||
|
||||
public:
|
||||
ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_CompleteAllRule; }
|
||||
|
||||
virtual void getChildren(vector<GameRuleDefinition *> *children);
|
||||
|
||||
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
|
||||
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item);
|
||||
|
||||
static wstring generateDescriptionString(const wstring &description, void *data, int dataLength);
|
||||
|
||||
private:
|
||||
void updateStatus(GameRule *rule);
|
||||
};
|
||||
118
Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
Normal file
118
Minecraft.Client/Common/GameRules/CompoundGameRuleDefinition.cpp
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
|
||||
#include "CompoundGameRuleDefinition.h"
|
||||
#include "ConsoleGameRules.h"
|
||||
|
||||
CompoundGameRuleDefinition::CompoundGameRuleDefinition()
|
||||
{
|
||||
m_lastRuleStatusChanged = NULL;
|
||||
}
|
||||
|
||||
CompoundGameRuleDefinition::~CompoundGameRuleDefinition()
|
||||
{
|
||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
||||
{
|
||||
delete (*it);
|
||||
}
|
||||
}
|
||||
|
||||
void CompoundGameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
GameRuleDefinition::getChildren(children);
|
||||
for (AUTO_VAR(it, m_children.begin()); it != m_children.end(); it++)
|
||||
children->push_back(*it);
|
||||
}
|
||||
|
||||
GameRuleDefinition *CompoundGameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_CompleteAllRule)
|
||||
{
|
||||
rule = new CompleteAllRuleDefinition();
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_CollectItemRule)
|
||||
{
|
||||
rule = new CollectItemRuleDefinition();
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_UseTileRule)
|
||||
{
|
||||
rule = new UseTileRuleDefinition();
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_UpdatePlayerRule)
|
||||
{
|
||||
rule = new UpdatePlayerRuleDefinition();
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"CompoundGameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
|
||||
#endif
|
||||
}
|
||||
if(rule != NULL) m_children.push_back(rule);
|
||||
return rule;
|
||||
}
|
||||
|
||||
void CompoundGameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule)
|
||||
{
|
||||
GameRule *newRule = NULL;
|
||||
int i = 0;
|
||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
||||
{
|
||||
newRule = new GameRule(*it, rule->getConnection() );
|
||||
(*it)->populateGameRule(type,newRule);
|
||||
|
||||
GameRule::ValueType value;
|
||||
value.gr = newRule;
|
||||
value.isPointer = true;
|
||||
|
||||
// Somehow add the newRule to the current rule
|
||||
rule->setParameter(L"rule" + _toString<int>(i),value);
|
||||
++i;
|
||||
}
|
||||
GameRuleDefinition::populateGameRule(type, rule);
|
||||
}
|
||||
|
||||
bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int y, int z)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
||||
{
|
||||
if(it->second.isPointer)
|
||||
{
|
||||
bool changed = it->second.gr->getGameRuleDefinition()->onUseTile(it->second.gr,tileId,x,y,z);
|
||||
if(!statusChanged && changed)
|
||||
{
|
||||
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
|
||||
statusChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return statusChanged;
|
||||
}
|
||||
|
||||
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
bool statusChanged = false;
|
||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
||||
{
|
||||
if(it->second.isPointer)
|
||||
{
|
||||
bool changed = it->second.gr->getGameRuleDefinition()->onCollectItem(it->second.gr,item);
|
||||
if(!statusChanged && changed)
|
||||
{
|
||||
m_lastRuleStatusChanged = it->second.gr->getGameRuleDefinition();
|
||||
statusChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return statusChanged;
|
||||
}
|
||||
|
||||
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
||||
{
|
||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
||||
{
|
||||
(*it)->postProcessPlayer(player);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include "GameRuleDefinition.h"
|
||||
|
||||
class CompoundGameRuleDefinition : public GameRuleDefinition
|
||||
{
|
||||
protected:
|
||||
vector<GameRuleDefinition *> m_children;
|
||||
protected:
|
||||
GameRuleDefinition *m_lastRuleStatusChanged;
|
||||
public:
|
||||
CompoundGameRuleDefinition();
|
||||
virtual ~CompoundGameRuleDefinition();
|
||||
|
||||
virtual void getChildren(vector<GameRuleDefinition *> *children);
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
|
||||
virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
|
||||
|
||||
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
|
||||
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item);
|
||||
virtual void postProcessPlayer(shared_ptr<Player> player);
|
||||
};
|
||||
32
Minecraft.Client/Common/GameRules/ConsoleGameRules.h
Normal file
32
Minecraft.Client/Common/GameRules/ConsoleGameRules.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
#include "ConsoleGameRulesConstants.h"
|
||||
|
||||
#include "GameRuleManager.h"
|
||||
|
||||
#include "GameRule.h"
|
||||
|
||||
#include "GameRuleDefinition.h"
|
||||
|
||||
#include "LevelRuleset.h"
|
||||
#include "NamedAreaRuleDefinition.h"
|
||||
|
||||
#include "CollectItemRuleDefinition.h"
|
||||
#include "CompleteAllRuleDefinition.h"
|
||||
#include "CompoundGameRuleDefinition.h"
|
||||
#include "UseTileRuleDefinition.h"
|
||||
#include "UpdatePlayerRuleDefinition.h"
|
||||
#include "AddItemRuleDefinition.h"
|
||||
#include "AddEnchantmentRuleDefinition.h"
|
||||
|
||||
#include "LevelGenerationOptions.h"
|
||||
#include "ApplySchematicRuleDefinition.h"
|
||||
#include "ConsoleGenerateStructure.h"
|
||||
#include "ConsoleGenerateStructureAction.h"
|
||||
#include "XboxStructureActionGenerateBox.h"
|
||||
#include "XboxStructureActionPlaceBlock.h"
|
||||
#include "XboxStructureActionPlaceContainer.h"
|
||||
#include "XboxStructureActionPlaceSpawner.h"
|
||||
#include "BiomeOverride.h"
|
||||
#include "StartFeature.h"
|
||||
|
||||
#include "GameRulesInstance.h"
|
||||
119
Minecraft.Client/Common/GameRules/ConsoleGameRulesConstants.h
Normal file
119
Minecraft.Client/Common/GameRules/ConsoleGameRulesConstants.h
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
#pragma once
|
||||
|
||||
//#include "
|
||||
|
||||
class ConsoleGameRules
|
||||
{
|
||||
public:
|
||||
enum EGameRuleType
|
||||
{
|
||||
eGameRuleType_Invalid = -1,
|
||||
eGameRuleType_Root = 0, // This is the top level rule that defines a game mode, this is used to generate data for new players
|
||||
|
||||
eGameRuleType_LevelGenerationOptions,
|
||||
eGameRuleType_ApplySchematic,
|
||||
eGameRuleType_GenerateStructure,
|
||||
eGameRuleType_GenerateBox,
|
||||
eGameRuleType_PlaceBlock,
|
||||
eGameRuleType_PlaceContainer,
|
||||
eGameRuleType_PlaceSpawner,
|
||||
eGameRuleType_BiomeOverride,
|
||||
eGameRuleType_StartFeature,
|
||||
|
||||
eGameRuleType_AddItem,
|
||||
eGameRuleType_AddEnchantment,
|
||||
|
||||
eGameRuleType_LevelRules,
|
||||
eGameRuleType_NamedArea,
|
||||
|
||||
eGameRuleType_UseTileRule,
|
||||
eGameRuleType_CollectItemRule,
|
||||
eGameRuleType_CompleteAllRule,
|
||||
eGameRuleType_UpdatePlayerRule,
|
||||
|
||||
eGameRuleType_Count
|
||||
};
|
||||
|
||||
enum EGameRuleAttr
|
||||
{
|
||||
eGameRuleAttr_Invalid = -1,
|
||||
|
||||
eGameRuleAttr_descriptionName = 0,
|
||||
eGameRuleAttr_promptName,
|
||||
eGameRuleAttr_dataTag,
|
||||
|
||||
eGameRuleAttr_enchantmentId,
|
||||
eGameRuleAttr_enchantmentLevel,
|
||||
|
||||
eGameRuleAttr_itemId,
|
||||
eGameRuleAttr_quantity,
|
||||
eGameRuleAttr_auxValue,
|
||||
eGameRuleAttr_slot,
|
||||
|
||||
eGameRuleAttr_name,
|
||||
|
||||
eGameRuleAttr_food,
|
||||
eGameRuleAttr_health,
|
||||
|
||||
eGameRuleAttr_tileId,
|
||||
eGameRuleAttr_useCoords,
|
||||
|
||||
eGameRuleAttr_seed,
|
||||
eGameRuleAttr_flatworld,
|
||||
|
||||
eGameRuleAttr_filename,
|
||||
eGameRuleAttr_rot,
|
||||
|
||||
eGameRuleAttr_data,
|
||||
eGameRuleAttr_block,
|
||||
eGameRuleAttr_entity,
|
||||
|
||||
eGameRuleAttr_facing,
|
||||
|
||||
eGameRuleAttr_edgeTile,
|
||||
eGameRuleAttr_fillTile,
|
||||
eGameRuleAttr_skipAir,
|
||||
|
||||
eGameRuleAttr_x,
|
||||
eGameRuleAttr_x0,
|
||||
eGameRuleAttr_x1,
|
||||
|
||||
eGameRuleAttr_y,
|
||||
eGameRuleAttr_y0,
|
||||
eGameRuleAttr_y1,
|
||||
|
||||
eGameRuleAttr_z,
|
||||
eGameRuleAttr_z0,
|
||||
eGameRuleAttr_z1,
|
||||
|
||||
eGameRuleAttr_chunkX,
|
||||
eGameRuleAttr_chunkZ,
|
||||
|
||||
eGameRuleAttr_yRot,
|
||||
|
||||
eGameRuleAttr_spawnX,
|
||||
eGameRuleAttr_spawnY,
|
||||
eGameRuleAttr_spawnZ,
|
||||
|
||||
eGameRuleAttr_orientation,
|
||||
eGameRuleAttr_dimension,
|
||||
|
||||
eGameRuleAttr_topTileId,
|
||||
eGameRuleAttr_biomeId,
|
||||
|
||||
eGameRuleAttr_feature,
|
||||
|
||||
eGameRuleAttr_Count
|
||||
};
|
||||
|
||||
static void write(DataOutputStream *dos, ConsoleGameRules::EGameRuleType eType)
|
||||
{
|
||||
dos->writeInt(eType);
|
||||
}
|
||||
|
||||
static void write(DataOutputStream *dos, ConsoleGameRules::EGameRuleAttr eAttr)
|
||||
{
|
||||
dos->writeInt( eGameRuleType_Count + eAttr );
|
||||
}
|
||||
|
||||
};
|
||||
181
Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp
Normal file
181
Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.cpp
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
#include "stdafx.h"
|
||||
#include "ConsoleGenerateStructure.h"
|
||||
#include "ConsoleGameRules.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.dimension.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.world.level.levelgen.structure.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "..\..\..\Minecraft.World\net.minecraft.h"
|
||||
|
||||
ConsoleGenerateStructure::ConsoleGenerateStructure() : StructurePiece(0)
|
||||
{
|
||||
m_x = m_y = m_z = 0;
|
||||
boundingBox = NULL;
|
||||
orientation = Direction::NORTH;
|
||||
m_dimension = 0;
|
||||
}
|
||||
|
||||
void ConsoleGenerateStructure::getChildren(vector<GameRuleDefinition *> *children)
|
||||
{
|
||||
GameRuleDefinition::getChildren(children);
|
||||
|
||||
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); it++)
|
||||
children->push_back( *it );
|
||||
}
|
||||
|
||||
GameRuleDefinition *ConsoleGenerateStructure::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
GameRuleDefinition *rule = NULL;
|
||||
if(ruleType == ConsoleGameRules::eGameRuleType_GenerateBox)
|
||||
{
|
||||
rule = new XboxStructureActionGenerateBox();
|
||||
m_actions.push_back((XboxStructureActionGenerateBox *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceBlock)
|
||||
{
|
||||
rule = new XboxStructureActionPlaceBlock();
|
||||
m_actions.push_back((XboxStructureActionPlaceBlock *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceContainer)
|
||||
{
|
||||
rule = new XboxStructureActionPlaceContainer();
|
||||
m_actions.push_back((XboxStructureActionPlaceContainer *)rule);
|
||||
}
|
||||
else if(ruleType == ConsoleGameRules::eGameRuleType_PlaceSpawner)
|
||||
{
|
||||
rule = new XboxStructureActionPlaceSpawner();
|
||||
m_actions.push_back((XboxStructureActionPlaceSpawner *)rule);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"ConsoleGenerateStructure: Attempted to add invalid child rule - %d\n", ruleType );
|
||||
#endif
|
||||
}
|
||||
return rule;
|
||||
}
|
||||
|
||||
void ConsoleGenerateStructure::writeAttributes(DataOutputStream *dos, UINT numAttrs)
|
||||
{
|
||||
GameRuleDefinition::writeAttributes(dos, numAttrs + 5);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_x);
|
||||
dos->writeUTF(_toString(m_x));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_y);
|
||||
dos->writeUTF(_toString(m_y));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_z);
|
||||
dos->writeUTF(_toString(m_z));
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_orientation);
|
||||
dos->writeUTF(_toString(orientation));
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dimension);
|
||||
dos->writeUTF(_toString(m_dimension));
|
||||
}
|
||||
|
||||
void ConsoleGenerateStructure::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
{
|
||||
if(attributeName.compare(L"x") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_x = value;
|
||||
app.DebugPrintf("ConsoleGenerateStructure: Adding parameter x=%d\n",m_x);
|
||||
}
|
||||
else if(attributeName.compare(L"y") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_y = value;
|
||||
app.DebugPrintf("ConsoleGenerateStructure: Adding parameter y=%d\n",m_y);
|
||||
}
|
||||
else if(attributeName.compare(L"z") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
m_z = value;
|
||||
app.DebugPrintf("ConsoleGenerateStructure: Adding parameter z=%d\n",m_z);
|
||||
}
|
||||
else if(attributeName.compare(L"orientation") == 0)
|
||||
{
|
||||
int value = _fromString<int>(attributeValue);
|
||||
orientation = value;
|
||||
app.DebugPrintf("ConsoleGenerateStructure: Adding parameter orientation=%d\n",orientation);
|
||||
}
|
||||
else if(attributeName.compare(L"dim") == 0)
|
||||
{
|
||||
m_dimension = _fromString<int>(attributeValue);
|
||||
if(m_dimension > 1 || m_dimension < -1) m_dimension = 0;
|
||||
app.DebugPrintf("ApplySchematicRuleDefinition: Adding parameter dimension=%d\n",m_dimension);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameRuleDefinition::addAttribute(attributeName, attributeValue);
|
||||
}
|
||||
}
|
||||
|
||||
BoundingBox* ConsoleGenerateStructure::getBoundingBox()
|
||||
{
|
||||
if(boundingBox == NULL)
|
||||
{
|
||||
// Find the max bounds
|
||||
int maxX, maxY, maxZ;
|
||||
maxX = maxY = maxZ = 1;
|
||||
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it)
|
||||
{
|
||||
ConsoleGenerateStructureAction *action = *it;
|
||||
maxX = max(maxX,action->getEndX());
|
||||
maxY = max(maxY,action->getEndY());
|
||||
maxZ = max(maxZ,action->getEndZ());
|
||||
}
|
||||
|
||||
boundingBox = new BoundingBox(m_x, m_y, m_z, m_x + maxX, m_y + maxY, m_z + maxZ);
|
||||
}
|
||||
return boundingBox;
|
||||
}
|
||||
|
||||
bool ConsoleGenerateStructure::postProcess(Level *level, Random *random, BoundingBox *chunkBB)
|
||||
{
|
||||
if(level->dimension->id != m_dimension) return false;
|
||||
|
||||
for(AUTO_VAR(it, m_actions.begin()); it != m_actions.end(); ++it)
|
||||
{
|
||||
ConsoleGenerateStructureAction *action = *it;
|
||||
|
||||
switch(action->getActionType())
|
||||
{
|
||||
case ConsoleGameRules::eGameRuleType_GenerateBox:
|
||||
{
|
||||
XboxStructureActionGenerateBox *genBox = (XboxStructureActionGenerateBox *)action;
|
||||
genBox->generateBoxInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
case ConsoleGameRules::eGameRuleType_PlaceBlock:
|
||||
{
|
||||
XboxStructureActionPlaceBlock *pPlaceBlock = (XboxStructureActionPlaceBlock *)action;
|
||||
pPlaceBlock->placeBlockInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
case ConsoleGameRules::eGameRuleType_PlaceContainer:
|
||||
{
|
||||
XboxStructureActionPlaceContainer *pPlaceContainer = (XboxStructureActionPlaceContainer *)action;
|
||||
pPlaceContainer->placeContainerInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
case ConsoleGameRules::eGameRuleType_PlaceSpawner:
|
||||
{
|
||||
XboxStructureActionPlaceSpawner *pPlaceSpawner = (XboxStructureActionPlaceSpawner *)action;
|
||||
pPlaceSpawner->placeSpawnerInLevel(this,level,chunkBB);
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConsoleGenerateStructure::checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1)
|
||||
{
|
||||
return getBoundingBox()->intersects(x0,y0,z0,x1,y1,z1);
|
||||
}
|
||||
|
||||
int ConsoleGenerateStructure::getMinY()
|
||||
{
|
||||
return getBoundingBox()->y0;
|
||||
}
|
||||
38
Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h
Normal file
38
Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
#include "GameRuleDefinition.h"
|
||||
#include "..\..\..\Minecraft.World\StructurePiece.h"
|
||||
|
||||
class Level;
|
||||
class Random;
|
||||
class BoundingBox;
|
||||
class ConsoleGenerateStructureAction;
|
||||
class XboxStructureActionPlaceContainer;
|
||||
class GRFObject;
|
||||
|
||||
class ConsoleGenerateStructure : public GameRuleDefinition, public StructurePiece
|
||||
{
|
||||
private:
|
||||
int m_x, m_y, m_z;
|
||||
vector<ConsoleGenerateStructureAction *> m_actions;
|
||||
int m_dimension;
|
||||
public:
|
||||
ConsoleGenerateStructure();
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() { return ConsoleGameRules::eGameRuleType_GenerateStructure; }
|
||||
|
||||
virtual void getChildren(vector<GameRuleDefinition *> *children);
|
||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||
|
||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttrs);
|
||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||
|
||||
// StructurePiece
|
||||
virtual BoundingBox *getBoundingBox();
|
||||
virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB);
|
||||
|
||||
void createContainer(XboxStructureActionPlaceContainer *action, Level *level, BoundingBox *chunkBB);
|
||||
|
||||
bool checkIntersects(int x0, int y0, int z0, int x1, int y1, int z1);
|
||||
|
||||
virtual int getMinY();
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "GameRuleDefinition.h"
|
||||
|
||||
class ConsoleGenerateStructureAction : public GameRuleDefinition
|
||||
{
|
||||
public:
|
||||
virtual int getEndX() = 0;
|
||||
virtual int getEndY() = 0;
|
||||
virtual int getEndZ() = 0;
|
||||
};
|
||||
1020
Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp
Normal file
1020
Minecraft.Client/Common/GameRules/ConsoleSchematicFile.cpp
Normal file
File diff suppressed because it is too large
Load diff
90
Minecraft.Client/Common/GameRules/ConsoleSchematicFile.h
Normal file
90
Minecraft.Client/Common/GameRules/ConsoleSchematicFile.h
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
#define XBOX_SCHEMATIC_ORIGINAL_VERSION 1
|
||||
#define XBOX_SCHEMATIC_CURRENT_VERSION 2
|
||||
|
||||
#include "..\..\..\Minecraft.World\ArrayWithLength.h"
|
||||
|
||||
class Level;
|
||||
class DataOutputStream;
|
||||
class DataInputStream;
|
||||
class TileEntity;
|
||||
class LevelChunk;
|
||||
class AABB;
|
||||
class Vec3;
|
||||
|
||||
class ConsoleSchematicFile
|
||||
{
|
||||
public:
|
||||
enum ESchematicRotation
|
||||
{
|
||||
eSchematicRot_0,
|
||||
eSchematicRot_90,
|
||||
eSchematicRot_180,
|
||||
eSchematicRot_270
|
||||
};
|
||||
private:
|
||||
int m_refCount;
|
||||
|
||||
public:
|
||||
void incrementRefCount() { ++m_refCount; }
|
||||
void decrementRefCount() { --m_refCount; }
|
||||
bool shouldDelete() { return m_refCount <= 0; }
|
||||
|
||||
typedef struct _XboxSchematicInitParam
|
||||
{
|
||||
wchar_t name[64];
|
||||
int startX;
|
||||
int startY;
|
||||
int startZ;
|
||||
int endX;
|
||||
int endY;
|
||||
int endZ;
|
||||
bool bSaveMobs;
|
||||
|
||||
Compression::ECompressionTypes compressionType;
|
||||
|
||||
_XboxSchematicInitParam()
|
||||
{
|
||||
ZeroMemory(name,64*(sizeof(wchar_t)));
|
||||
startX = startY = startZ = endX = endY = endZ = 0;
|
||||
bSaveMobs = false;
|
||||
compressionType = Compression::eCompressionType_None;
|
||||
}
|
||||
} XboxSchematicInitParam;
|
||||
private:
|
||||
int m_xSize, m_ySize, m_zSize;
|
||||
vector<shared_ptr<TileEntity> > m_tileEntities;
|
||||
vector< pair<Vec3 *, CompoundTag *> > m_entities;
|
||||
|
||||
public:
|
||||
byteArray m_data;
|
||||
|
||||
public:
|
||||
ConsoleSchematicFile();
|
||||
~ConsoleSchematicFile();
|
||||
|
||||
int getXSize() { return m_xSize; }
|
||||
int getYSize() { return m_ySize; }
|
||||
int getZSize() { return m_zSize; }
|
||||
|
||||
void save(DataOutputStream *dos);
|
||||
void load(DataInputStream *dis);
|
||||
|
||||
__int64 applyBlocksAndData(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
__int64 applyLighting(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
void applyTileEntities(LevelChunk *chunk, AABB *chunkBox, AABB *destinationBox, ESchematicRotation rot);
|
||||
|
||||
static void generateSchematicFile(DataOutputStream *dos, Level *level, int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, bool bSaveMobs, Compression::ECompressionTypes);
|
||||
static void setBlocksAndData(LevelChunk *chunk, byteArray blockData, byteArray dataData, byteArray data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP);
|
||||
private:
|
||||
void save_tags(DataOutputStream *dos);
|
||||
void load_tags(DataInputStream *dis);
|
||||
|
||||
static void getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP);
|
||||
static vector<shared_ptr<TileEntity> > *getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1);
|
||||
|
||||
void chunkCoordToSchematicCoord(AABB *destinationBox, int chunkX, int chunkZ, ESchematicRotation rot, int &schematicX, int &schematicZ);
|
||||
void schematicCoordToChunkCoord(AABB *destinationBox, double schematicX, double schematicZ, ESchematicRotation rot, double &chunkX, double &chunkZ);
|
||||
};
|
||||
97
Minecraft.Client/Common/GameRules/GameRule.cpp
Normal file
97
Minecraft.Client/Common/GameRules/GameRule.cpp
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
#include "stdafx.h"
|
||||
#include "ConsoleGameRules.h"
|
||||
|
||||
GameRule::GameRule(GameRuleDefinition *definition, Connection *connection)
|
||||
{
|
||||
m_definition = definition;
|
||||
m_connection = connection;
|
||||
}
|
||||
|
||||
GameRule::~GameRule()
|
||||
{
|
||||
for(AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); ++it)
|
||||
{
|
||||
if(it->second.isPointer)
|
||||
{
|
||||
delete it->second.gr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GameRule::ValueType GameRule::getParameter(const wstring ¶meterName)
|
||||
{
|
||||
if(m_parameters.find(parameterName) == m_parameters.end())
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"WARNING: Parameter %ls was not set before being fetched\n", parameterName.c_str());
|
||||
__debugbreak();
|
||||
#endif
|
||||
}
|
||||
return m_parameters[parameterName];
|
||||
}
|
||||
|
||||
void GameRule::setParameter(const wstring ¶meterName,ValueType value)
|
||||
{
|
||||
if(m_parameters.find(parameterName) == m_parameters.end())
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"Adding parameter %ls to GameRule\n", parameterName.c_str());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"Setting parameter %ls for GameRule\n", parameterName.c_str());
|
||||
#endif
|
||||
}
|
||||
m_parameters[parameterName] = value;
|
||||
}
|
||||
|
||||
GameRuleDefinition *GameRule::getGameRuleDefinition()
|
||||
{
|
||||
return m_definition;
|
||||
}
|
||||
|
||||
void GameRule::onUseTile(int tileId, int x, int y, int z) { m_definition->onUseTile(this,tileId,x,y,z); }
|
||||
void GameRule::onCollectItem(shared_ptr<ItemInstance> item) { m_definition->onCollectItem(this,item); }
|
||||
|
||||
void GameRule::write(DataOutputStream *dos)
|
||||
{
|
||||
// Find required parameters.
|
||||
dos->writeInt(m_parameters.size());
|
||||
for (AUTO_VAR(it, m_parameters.begin()); it != m_parameters.end(); it++)
|
||||
{
|
||||
wstring pName = (*it).first;
|
||||
ValueType vType = (*it).second;
|
||||
|
||||
dos->writeUTF( (*it).first );
|
||||
dos->writeBoolean( vType.isPointer );
|
||||
|
||||
if (vType.isPointer)
|
||||
vType.gr->write(dos);
|
||||
else
|
||||
dos->writeLong( vType.i64 );
|
||||
}
|
||||
}
|
||||
|
||||
void GameRule::read(DataInputStream *dis)
|
||||
{
|
||||
int savedParams = dis->readInt();
|
||||
for (int i = 0; i < savedParams; i++)
|
||||
{
|
||||
wstring pNames = dis->readUTF();
|
||||
|
||||
ValueType vType = getParameter(pNames);
|
||||
|
||||
if (dis->readBoolean())
|
||||
{
|
||||
vType.gr->read(dis);
|
||||
}
|
||||
else
|
||||
{
|
||||
vType.isPointer = false;
|
||||
vType.i64 = dis->readLong();
|
||||
setParameter(pNames, vType);
|
||||
}
|
||||
}
|
||||
}
|
||||
62
Minecraft.Client/Common/GameRules/GameRule.h
Normal file
62
Minecraft.Client/Common/GameRules/GameRule.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#pragma once
|
||||
using namespace std;
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
class CompoundTag;
|
||||
class GameRuleDefinition;
|
||||
class Connection;
|
||||
|
||||
// A game rule maintains the state for one particular definition
|
||||
class GameRule
|
||||
{
|
||||
public:
|
||||
typedef struct _ValueType
|
||||
{
|
||||
union{
|
||||
__int64 i64;
|
||||
int i;
|
||||
char c;
|
||||
bool b;
|
||||
float f;
|
||||
double d;
|
||||
GameRule *gr;
|
||||
};
|
||||
bool isPointer;
|
||||
|
||||
_ValueType()
|
||||
{
|
||||
i64 = 0;
|
||||
isPointer = false;
|
||||
}
|
||||
} ValueType;
|
||||
|
||||
private:
|
||||
GameRuleDefinition *m_definition;
|
||||
Connection *m_connection;
|
||||
|
||||
public:
|
||||
typedef unordered_map<wstring,ValueType> stringValueMapType;
|
||||
stringValueMapType m_parameters; // These are the members of this rule that maintain it's state
|
||||
|
||||
public:
|
||||
GameRule(GameRuleDefinition *definition, Connection *connection = NULL);
|
||||
virtual ~GameRule();
|
||||
|
||||
Connection *getConnection() { return m_connection; }
|
||||
|
||||
ValueType getParameter(const wstring ¶meterName);
|
||||
void setParameter(const wstring ¶meterName,ValueType value);
|
||||
GameRuleDefinition *getGameRuleDefinition();
|
||||
|
||||
// All the hooks go here
|
||||
void onUseTile(int tileId, int x, int y, int z);
|
||||
void onCollectItem(shared_ptr<ItemInstance> item);
|
||||
|
||||
// 4J-JEV: For saving.
|
||||
//CompoundTag *toTags(unordered_map<GameRuleDefinition *, int> *map);
|
||||
//static GameRule *fromTags(Connection *c, CompoundTag *cTag, vector<GameRuleDefinition *> *grds);
|
||||
|
||||
void write(DataOutputStream *dos);
|
||||
void read(DataInputStream *dos);
|
||||
};
|
||||
151
Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp
Normal file
151
Minecraft.Client/Common/GameRules/GameRuleDefinition.cpp
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
#include "stdafx.h"
|
||||
#include "..\..\WstringLookup.h"
|
||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||
#include "ConsoleGameRules.h"
|
||||
|
||||
GameRuleDefinition::GameRuleDefinition()
|
||||
{
|
||||
m_descriptionId = L"";
|
||||
m_promptId = L"";
|
||||
m_4JDataValue = 0;
|
||||
}
|
||||
|
||||
void GameRuleDefinition::write(DataOutputStream *dos)
|
||||
{
|
||||
// Write EGameRuleType.
|
||||
ConsoleGameRules::EGameRuleType eType = getActionType();
|
||||
assert( eType != ConsoleGameRules::eGameRuleType_Invalid );
|
||||
ConsoleGameRules::write(dos, eType); // stringID
|
||||
|
||||
writeAttributes(dos, 0);
|
||||
|
||||
// 4J-JEV: Get children.
|
||||
vector<GameRuleDefinition *> *children = new vector<GameRuleDefinition *>();
|
||||
getChildren( children );
|
||||
|
||||
// Write children.
|
||||
dos->writeInt( children->size() );
|
||||
for (AUTO_VAR(it, children->begin()); it != children->end(); it++)
|
||||
(*it)->write(dos);
|
||||
}
|
||||
|
||||
void GameRuleDefinition::writeAttributes(DataOutputStream *dos, UINT numAttributes)
|
||||
{
|
||||
dos->writeInt(numAttributes + 3);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_descriptionName);
|
||||
dos->writeUTF(m_descriptionId);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_promptName);
|
||||
dos->writeUTF(m_promptId);
|
||||
|
||||
ConsoleGameRules::write(dos, ConsoleGameRules::eGameRuleAttr_dataTag);
|
||||
dos->writeUTF(_toString(m_4JDataValue));
|
||||
}
|
||||
|
||||
void GameRuleDefinition::getChildren(vector<GameRuleDefinition *> *children) {}
|
||||
|
||||
GameRuleDefinition *GameRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType)
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"GameRuleDefinition: Attempted to add invalid child rule - %d\n", ruleType );
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GameRuleDefinition::addAttribute(const wstring &attributeName, const wstring &attributeValue)
|
||||
{
|
||||
if(attributeName.compare(L"descriptionName") == 0)
|
||||
{
|
||||
m_descriptionId = attributeValue;
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"GameRuleDefinition: Adding parameter descriptionId=%ls\n",m_descriptionId.c_str());
|
||||
#endif
|
||||
}
|
||||
else if(attributeName.compare(L"promptName") == 0)
|
||||
{
|
||||
m_promptId = attributeValue;
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"GameRuleDefinition: Adding parameter m_promptId=%ls\n",m_promptId.c_str());
|
||||
#endif
|
||||
}
|
||||
else if(attributeName.compare(L"dataTag") == 0)
|
||||
{
|
||||
m_4JDataValue = _fromString<int>(attributeValue);
|
||||
app.DebugPrintf("GameRuleDefinition: Adding parameter m_4JDataValue=%d\n",m_4JDataValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
wprintf(L"GameRuleDefinition: Attempted to add invalid attribute: %ls\n", attributeName.c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void GameRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule)
|
||||
{
|
||||
GameRule::ValueType value;
|
||||
value.b = false;
|
||||
rule->setParameter(L"bComplete",value);
|
||||
}
|
||||
|
||||
bool GameRuleDefinition::getComplete(GameRule *rule)
|
||||
{
|
||||
GameRule::ValueType value;
|
||||
value = rule->getParameter(L"bComplete");
|
||||
return value.b;
|
||||
}
|
||||
|
||||
void GameRuleDefinition::setComplete(GameRule *rule, bool val)
|
||||
{
|
||||
GameRule::ValueType value;
|
||||
value = rule->getParameter(L"bComplete");
|
||||
value.b = val;
|
||||
rule->setParameter(L"bComplete",value);
|
||||
}
|
||||
|
||||
vector<GameRuleDefinition *> *GameRuleDefinition::enumerate()
|
||||
{
|
||||
// Get Vector.
|
||||
vector<GameRuleDefinition *> *gRules;
|
||||
gRules = new vector<GameRuleDefinition *>();
|
||||
gRules->push_back(this);
|
||||
getChildren(gRules);
|
||||
return gRules;
|
||||
}
|
||||
|
||||
unordered_map<GameRuleDefinition *, int> *GameRuleDefinition::enumerateMap()
|
||||
{
|
||||
unordered_map<GameRuleDefinition *, int> *out
|
||||
= new unordered_map<GameRuleDefinition *, int>();
|
||||
|
||||
int i = 0;
|
||||
vector<GameRuleDefinition *> *gRules = enumerate();
|
||||
for (AUTO_VAR(it, gRules->begin()); it != gRules->end(); it++)
|
||||
out->insert( pair<GameRuleDefinition *, int>( *it, i++ ) );
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
GameRulesInstance *GameRuleDefinition::generateNewGameRulesInstance(GameRulesInstance::EGameRulesInstanceType type, LevelRuleset *rules, Connection *connection)
|
||||
{
|
||||
GameRulesInstance *manager = new GameRulesInstance(rules, connection);
|
||||
|
||||
rules->populateGameRule(type, manager);
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
wstring GameRuleDefinition::generateDescriptionString(ConsoleGameRules::EGameRuleType defType, const wstring &description, void *data, int dataLength)
|
||||
{
|
||||
wstring formatted = description;
|
||||
switch(defType)
|
||||
{
|
||||
case ConsoleGameRules::eGameRuleType_CompleteAllRule:
|
||||
formatted = CompleteAllRuleDefinition::generateDescriptionString(description,data,dataLength);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
return formatted;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue