mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
assembly fixes in vs2015
This commit is contained in:
parent
dc91a1dad0
commit
a3c5604375
|
|
@ -1,217 +1,223 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "UI.h"
|
#include "UI.h"
|
||||||
#include "UIControl_EnchantmentButton.h"
|
#include "UIControl_EnchantmentButton.h"
|
||||||
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
|
||||||
#include "..\..\Minecraft.h"
|
#include "..\..\Minecraft.h"
|
||||||
#include "..\..\MultiplayerLocalPlayer.h"
|
#include "..\..\MultiplayerLocalPlayer.h"
|
||||||
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
#include "..\..\..\Minecraft.World\StringHelpers.h"
|
||||||
|
#include <sstream>
|
||||||
UIControl_EnchantmentButton::UIControl_EnchantmentButton()
|
#include <iterator>
|
||||||
{
|
#include <algorithm>
|
||||||
m_index = 0;
|
|
||||||
m_lastState = eState_Inactive;
|
UIControl_EnchantmentButton::UIControl_EnchantmentButton()
|
||||||
m_lastCost = 0;
|
{
|
||||||
m_enchantmentString = L"";
|
m_index = 0;
|
||||||
m_bHasFocus = false;
|
m_lastState = eState_Inactive;
|
||||||
|
m_lastCost = 0;
|
||||||
m_textColour = app.GetHTMLColour(eTextColor_Enchant);
|
m_enchantmentString = L"";
|
||||||
m_textFocusColour = app.GetHTMLColour(eTextColor_EnchantFocus);
|
m_bHasFocus = false;
|
||||||
m_textDisabledColour = app.GetHTMLColour(eTextColor_EnchantDisabled);
|
|
||||||
}
|
m_textColour = app.GetHTMLColour(eTextColor_Enchant);
|
||||||
|
m_textFocusColour = app.GetHTMLColour(eTextColor_EnchantFocus);
|
||||||
bool UIControl_EnchantmentButton::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName)
|
m_textDisabledColour = app.GetHTMLColour(eTextColor_EnchantDisabled);
|
||||||
{
|
}
|
||||||
UIControl::setControlType(UIControl::eEnchantmentButton);
|
|
||||||
bool success = UIControl_Button::setupControl(scene,parent,controlName);
|
bool UIControl_EnchantmentButton::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName)
|
||||||
|
{
|
||||||
//Button specific initialisers
|
UIControl::setControlType(UIControl::eEnchantmentButton);
|
||||||
m_funcChangeState = registerFastName(L"ChangeState");
|
bool success = UIControl_Button::setupControl(scene,parent,controlName);
|
||||||
|
|
||||||
return success;
|
//Button specific initialisers
|
||||||
}
|
m_funcChangeState = registerFastName(L"ChangeState");
|
||||||
|
|
||||||
void UIControl_EnchantmentButton::init(int index)
|
return success;
|
||||||
{
|
}
|
||||||
m_index = index;
|
|
||||||
}
|
void UIControl_EnchantmentButton::init(int index)
|
||||||
|
{
|
||||||
|
m_index = index;
|
||||||
void UIControl_EnchantmentButton::ReInit()
|
}
|
||||||
{
|
|
||||||
UIControl_Button::ReInit();
|
|
||||||
|
void UIControl_EnchantmentButton::ReInit()
|
||||||
|
{
|
||||||
m_lastState = eState_Inactive;
|
UIControl_Button::ReInit();
|
||||||
m_lastCost = 0;
|
|
||||||
m_bHasFocus = false;
|
|
||||||
updateState();
|
m_lastState = eState_Inactive;
|
||||||
}
|
m_lastCost = 0;
|
||||||
|
m_bHasFocus = false;
|
||||||
void UIControl_EnchantmentButton::tick()
|
updateState();
|
||||||
{
|
}
|
||||||
updateState();
|
|
||||||
UIControl_Button::tick();
|
void UIControl_EnchantmentButton::tick()
|
||||||
}
|
{
|
||||||
|
updateState();
|
||||||
void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region)
|
UIControl_Button::tick();
|
||||||
{
|
}
|
||||||
UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene;
|
|
||||||
EnchantmentMenu *menu = enchantingScene->getMenu();
|
void UIControl_EnchantmentButton::render(IggyCustomDrawCallbackRegion *region)
|
||||||
|
{
|
||||||
float width = region->x1 - region->x0;
|
UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene;
|
||||||
float height = region->y1 - region->y0;
|
EnchantmentMenu *menu = enchantingScene->getMenu();
|
||||||
float xo = width/2;
|
|
||||||
float yo = height;
|
float width = region->x1 - region->x0;
|
||||||
//glTranslatef(xo, yo, 50.0f);
|
float height = region->y1 - region->y0;
|
||||||
|
float xo = width/2;
|
||||||
// Revert the scale from the setup
|
float yo = height;
|
||||||
float ssX = width/m_width;
|
//glTranslatef(xo, yo, 50.0f);
|
||||||
float ssY = height/m_height;
|
|
||||||
glScalef(ssX, ssY,1.0f);
|
// Revert the scale from the setup
|
||||||
|
float ssX = width/m_width;
|
||||||
float ss = 1.0f;
|
float ssY = height/m_height;
|
||||||
|
glScalef(ssX, ssY,1.0f);
|
||||||
#if TO_BE_IMPLEMENTED
|
|
||||||
if(!enchantingScene->m_bSplitscreen)
|
float ss = 1.0f;
|
||||||
#endif
|
|
||||||
{
|
#if TO_BE_IMPLEMENTED
|
||||||
switch(enchantingScene->getSceneResolution())
|
if(!enchantingScene->m_bSplitscreen)
|
||||||
{
|
#endif
|
||||||
case UIScene::eSceneResolution_1080:
|
{
|
||||||
ss = 3.0f;
|
switch(enchantingScene->getSceneResolution())
|
||||||
break;
|
{
|
||||||
default:
|
case UIScene::eSceneResolution_1080:
|
||||||
ss = 2.0f;
|
ss = 3.0f;
|
||||||
break;
|
break;
|
||||||
}
|
default:
|
||||||
}
|
ss = 2.0f;
|
||||||
|
break;
|
||||||
glScalef(ss, ss, ss);
|
}
|
||||||
|
}
|
||||||
int cost = menu->costs[m_index];
|
|
||||||
|
glScalef(ss, ss, ss);
|
||||||
//if(cost != m_lastCost)
|
|
||||||
//{
|
int cost = menu->costs[m_index];
|
||||||
// updateState();
|
|
||||||
//}
|
//if(cost != m_lastCost)
|
||||||
|
//{
|
||||||
glColor4f(1, 1, 1, 1);
|
// updateState();
|
||||||
if (cost != 0)
|
//}
|
||||||
{
|
|
||||||
glEnable(GL_ALPHA_TEST);
|
glColor4f(1, 1, 1, 1);
|
||||||
glAlphaFunc(GL_GREATER, 0.1f);
|
if (cost != 0)
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
{
|
||||||
wstring line = std::to_wstring(cost);
|
glEnable(GL_ALPHA_TEST);
|
||||||
Font *font = pMinecraft->altFont;
|
glAlphaFunc(GL_GREATER, 0.1f);
|
||||||
//int col = 0x685E4A;
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
unsigned int col = m_textColour;
|
wstring line = std::to_wstring(cost);
|
||||||
if (pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel < cost && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild)
|
Font *font = pMinecraft->altFont;
|
||||||
{
|
//int col = 0x685E4A;
|
||||||
col = m_textDisabledColour;
|
unsigned int col = m_textColour;
|
||||||
font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width/ss, col, (float)m_height/ss);
|
if (pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel < cost && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild)
|
||||||
font = pMinecraft->font;
|
{
|
||||||
//col = (0x80ff20 & 0xfefefe) >> 1;
|
col = m_textDisabledColour;
|
||||||
//font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col);
|
font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width/ss, col, (float)m_height/ss);
|
||||||
}
|
font = pMinecraft->font;
|
||||||
else
|
//col = (0x80ff20 & 0xfefefe) >> 1;
|
||||||
{
|
//font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col);
|
||||||
if (m_bHasFocus)
|
}
|
||||||
{
|
else
|
||||||
//col = 0xffff80;
|
{
|
||||||
col = m_textFocusColour;
|
if (m_bHasFocus)
|
||||||
}
|
{
|
||||||
font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width/ss, col, (float)m_height/ss);
|
//col = 0xffff80;
|
||||||
font = pMinecraft->font;
|
col = m_textFocusColour;
|
||||||
//col = 0x80ff20;
|
}
|
||||||
//font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col);
|
font->drawWordWrap(m_enchantmentString, 0, 0, (float)m_width/ss, col, (float)m_height/ss);
|
||||||
}
|
font = pMinecraft->font;
|
||||||
glDisable(GL_ALPHA_TEST);
|
//col = 0x80ff20;
|
||||||
}
|
//font->drawShadow(line, (bwidth - font->width(line))/ss, 7, col);
|
||||||
else
|
}
|
||||||
{
|
glDisable(GL_ALPHA_TEST);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
//Lighting::turnOff();
|
{
|
||||||
glDisable(GL_RESCALE_NORMAL);
|
}
|
||||||
}
|
|
||||||
|
//Lighting::turnOff();
|
||||||
void UIControl_EnchantmentButton::updateState()
|
glDisable(GL_RESCALE_NORMAL);
|
||||||
{
|
}
|
||||||
UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene;
|
|
||||||
EnchantmentMenu *menu = enchantingScene->getMenu();
|
void UIControl_EnchantmentButton::updateState()
|
||||||
|
{
|
||||||
EState state = eState_Inactive;
|
UIScene_EnchantingMenu *enchantingScene = (UIScene_EnchantingMenu *)m_parentScene;
|
||||||
|
EnchantmentMenu *menu = enchantingScene->getMenu();
|
||||||
int cost = menu->costs[m_index];
|
|
||||||
|
EState state = eState_Inactive;
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
|
||||||
if(cost > pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild)
|
int cost = menu->costs[m_index];
|
||||||
{
|
|
||||||
// Dark background
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
state = eState_Inactive;
|
if(cost > pMinecraft->localplayers[enchantingScene->getPad()]->experienceLevel && !pMinecraft->localplayers[enchantingScene->getPad()]->abilities.instabuild)
|
||||||
}
|
{
|
||||||
else
|
// Dark background
|
||||||
{
|
state = eState_Inactive;
|
||||||
// Light background and focus background
|
}
|
||||||
if(m_bHasFocus)
|
else
|
||||||
{
|
{
|
||||||
state = eState_Selected;
|
// Light background and focus background
|
||||||
}
|
if(m_bHasFocus)
|
||||||
else
|
{
|
||||||
{
|
state = eState_Selected;
|
||||||
state = eState_Active;
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
|
state = eState_Active;
|
||||||
if(cost != m_lastCost)
|
}
|
||||||
{
|
}
|
||||||
setLabel( std::to_wstring(cost) );
|
|
||||||
m_lastCost = cost;
|
if(cost != m_lastCost)
|
||||||
m_enchantmentString = EnchantmentNames::instance.getRandomName();
|
{
|
||||||
}
|
setLabel( std::to_wstring(cost) );
|
||||||
if(cost == 0)
|
m_lastCost = cost;
|
||||||
{
|
m_enchantmentString = EnchantmentNames::instance.getRandomName();
|
||||||
// Dark background
|
}
|
||||||
state = eState_Inactive;
|
if(cost == 0)
|
||||||
setLabel(L"");
|
{
|
||||||
}
|
// Dark background
|
||||||
|
state = eState_Inactive;
|
||||||
if(state != m_lastState)
|
setLabel(L"");
|
||||||
{
|
}
|
||||||
IggyDataValue result;
|
|
||||||
IggyDataValue value[1];
|
if(state != m_lastState)
|
||||||
|
{
|
||||||
value[0].type = IGGY_DATATYPE_number;
|
IggyDataValue result;
|
||||||
value[0].number = (int)state;
|
IggyDataValue value[1];
|
||||||
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcChangeState , 1 , value );
|
|
||||||
|
value[0].type = IGGY_DATATYPE_number;
|
||||||
if(out == IGGY_RESULT_SUCCESS) m_lastState = state;
|
value[0].number = (int)state;
|
||||||
}
|
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcChangeState , 1 , value );
|
||||||
}
|
|
||||||
|
if(out == IGGY_RESULT_SUCCESS) m_lastState = state;
|
||||||
void UIControl_EnchantmentButton::setFocus(bool focus)
|
}
|
||||||
{
|
}
|
||||||
m_bHasFocus = focus;
|
|
||||||
updateState();
|
void UIControl_EnchantmentButton::setFocus(bool focus)
|
||||||
}
|
{
|
||||||
|
m_bHasFocus = focus;
|
||||||
UIControl_EnchantmentButton::EnchantmentNames UIControl_EnchantmentButton::EnchantmentNames::instance;
|
updateState();
|
||||||
|
}
|
||||||
UIControl_EnchantmentButton::EnchantmentNames::EnchantmentNames()
|
|
||||||
{
|
UIControl_EnchantmentButton::EnchantmentNames UIControl_EnchantmentButton::EnchantmentNames::instance;
|
||||||
wstring allWords = L"the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale ";
|
|
||||||
std::wistringstream iss(allWords);
|
UIControl_EnchantmentButton::EnchantmentNames::EnchantmentNames()
|
||||||
std::copy(std::istream_iterator< std::wstring, wchar_t, std::char_traits<wchar_t> >(iss), std::istream_iterator< std::wstring, wchar_t, std::char_traits<wchar_t> >(),std::back_inserter(words));
|
{
|
||||||
}
|
wstring allWords = L"the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale ";
|
||||||
|
std::wistringstream iss(allWords);
|
||||||
wstring UIControl_EnchantmentButton::EnchantmentNames::getRandomName()
|
std::wstring word;
|
||||||
{
|
while (iss >> word) {
|
||||||
int wordCount = random.nextInt(2) + 3;
|
words.push_back(word);
|
||||||
wstring word = L"";
|
}
|
||||||
for (int i = 0; i < wordCount; i++)
|
}
|
||||||
{
|
|
||||||
if (i > 0) word += L" ";
|
wstring UIControl_EnchantmentButton::EnchantmentNames::getRandomName()
|
||||||
word += words[random.nextInt(words.size())];
|
{
|
||||||
}
|
int wordCount = random.nextInt(2) + 3;
|
||||||
return word;
|
wstring word = L"";
|
||||||
}
|
for (int i = 0; i < wordCount; i++)
|
||||||
|
{
|
||||||
|
if (i > 0) word += L" ";
|
||||||
|
word += words[random.nextInt(words.size())];
|
||||||
|
}
|
||||||
|
return word;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue