Merge branch 'master' into wp8
This commit is contained in:
@@ -3,7 +3,15 @@ before_install:
|
||||
- export PSPDEV="$TRAVIS_BUILD_DIR/opt/pspsdk"
|
||||
- export PSPSDK="$PSPDEV/psp/sdk"
|
||||
- export PATH="$PATH:$PSPDEV/bin:$PSPSDK/bin"
|
||||
- export ANDROID="android-sdk-linux/tools/android"
|
||||
install:
|
||||
- sudo apt-get update -qq
|
||||
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch; fi
|
||||
- wget -O sdk.lzma http://sourceforge.net/projects/minpspw/files/SDK%20%2B%20devpak/pspsdk%200.11.2/minpspw_0.11.2-amd64.tar.lzma/download
|
||||
- tar -x --xz -f sdk.lzma
|
||||
- wget http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2 -nv
|
||||
- wget http://dl.google.com/android/android-sdk_r22-linux.tgz -nv
|
||||
- tar --absolute-names -jxf android-ndk-r9-linux-x86_64.tar.bz2
|
||||
- tar -zxf android-sdk_r22-linux.tgz
|
||||
- echo yes | $ANDROID update sdk --filter 1,2,3,8 --no-ui --force > log.txt
|
||||
script: "./travis-script.sh"
|
||||
|
||||
@@ -44,6 +44,17 @@ typedef WPARAM LocalKeySym;
|
||||
#include <X11/keysym.h>
|
||||
typedef KeySym LocalKeySym;
|
||||
#define LOCAL_KEY_NONE XK_VoidSymbol
|
||||
#undef Status
|
||||
#undef Bool
|
||||
#undef None
|
||||
#undef CursorShape
|
||||
#undef KeyPress
|
||||
#undef KeyRelease
|
||||
#undef FocusIn
|
||||
#undef FocusOut
|
||||
#undef FontChange
|
||||
#undef Unsorted
|
||||
#undef GrayScale
|
||||
|
||||
#elif defined(ANDROID) // This is temporary until we understand how to send real key events from Java
|
||||
typedef long unsigned int LocalKeySym;
|
||||
|
||||
@@ -3,15 +3,6 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/*************************** Macros and constants ***************************/
|
||||
// returns a number ranging from -1.0 to 1.0
|
||||
#define FRAND (((float)rand()-(float)rand())/RAND_MAX)
|
||||
#define Clamp(x, min, max) x = (x<min ? min : x<max ? x : max);
|
||||
|
||||
#define SQUARE(x) (x)*(x)
|
||||
|
||||
|
||||
struct Vector3D
|
||||
{
|
||||
Vector3D(float x, float y, float z) : x(x), y(y), z(z) {}
|
||||
@@ -63,7 +54,7 @@ struct Vector3D
|
||||
|
||||
float Length()
|
||||
{
|
||||
float length = (float)sqrt(SQUARE(x) + SQUARE(y) + SQUARE(z));
|
||||
float length = sqrt(x*x + y*y + z*z);
|
||||
return (length != 0.0f) ? length : 1.0f;
|
||||
}
|
||||
|
||||
|
||||
1
projects/mtg/Android/.gitignore
vendored
1
projects/mtg/Android/.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
/gen
|
||||
/bin
|
||||
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
|
||||
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity" android:screenOrientation="sensorLandscape"/>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9"/>
|
||||
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/>
|
||||
</manifest>
|
||||
|
||||
@@ -41,7 +41,6 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
|
||||
$(MTG_PATH)/src/AllAbilities.cpp \
|
||||
$(MTG_PATH)/src/CardDescriptor.cpp \
|
||||
$(MTG_PATH)/src/CardDisplay.cpp \
|
||||
$(MTG_PATH)/src/CardEffect.cpp \
|
||||
$(MTG_PATH)/src/CardGui.cpp \
|
||||
$(MTG_PATH)/src/CardPrimitive.cpp \
|
||||
$(MTG_PATH)/src/CardSelector.cpp \
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _CACHE_ENGINE_H_
|
||||
#define _CACHE_ENGINE_H_
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "Threading.h"
|
||||
@@ -208,3 +211,5 @@ public:
|
||||
|
||||
CardRetrieverBase* CacheEngine::sInstance = NULL;
|
||||
bool CacheEngine::sIsThreaded = false;
|
||||
|
||||
#endif //_CACHE_ENGINE_H_
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#ifndef _DECK_EDITOR_MENU_H
|
||||
#define _DECK_EDITOR_MENU_H
|
||||
#pragma once
|
||||
#include "DeckMenu.h"
|
||||
#include "DeckDataWrapper.h"
|
||||
@@ -19,3 +21,4 @@ public:
|
||||
void Render();
|
||||
virtual ~DeckEditorMenu();
|
||||
};
|
||||
#endif //_DECK_EDITOR_MENU_H
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _DECK_MANAGER_H
|
||||
#define _DECK_MANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -43,3 +46,5 @@ public:
|
||||
~DeckManager();
|
||||
|
||||
};
|
||||
|
||||
#endif //_DECK_MANAGER_H
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _GUI_MANA_H
|
||||
#define _GUI_MANA_H
|
||||
|
||||
#include "string.h"
|
||||
#include <vector>
|
||||
#include <hge/hgeparticle.h>
|
||||
@@ -51,3 +54,5 @@ public:
|
||||
virtual int receiveEventPlus(WEvent * e);
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
};
|
||||
|
||||
#endif //_GUI_MANA_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef _MTGPACCK_H_
|
||||
#ifndef _MTGPACK_H_
|
||||
#define _MTGPACK_H_
|
||||
|
||||
class ShopBooster;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _STYLE_MANAGER_H_
|
||||
#define _STYLE_MANAGER_H_
|
||||
|
||||
class WStyle
|
||||
{
|
||||
public:
|
||||
@@ -34,3 +37,5 @@ protected:
|
||||
string activeStyle;
|
||||
map<string, WStyle*> styles;
|
||||
};
|
||||
|
||||
#endif //_STYLE_MANAGER_H_
|
||||
|
||||
@@ -7,42 +7,42 @@
|
||||
#include "Closest.cpp"
|
||||
#include "GameObserver.h"
|
||||
|
||||
struct Left: public Exp
|
||||
struct CardSelectorLeft: public Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
|
||||
{
|
||||
return ref->x - test->x > fabs(ref->y - test->y);
|
||||
}
|
||||
};
|
||||
struct Right: public Exp
|
||||
struct CardSelectorRight: public Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
|
||||
{
|
||||
return test->x - ref->x > fabs(ref->y - test->y);
|
||||
}
|
||||
};
|
||||
struct Up: public Exp
|
||||
struct CardSelectorUp: public Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
|
||||
{
|
||||
return ref->y - test->y > fabs(ref->x - test->x);
|
||||
}
|
||||
};
|
||||
struct Down: public Exp
|
||||
struct CardSelectorDown: public Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
|
||||
{
|
||||
return test->y - ref->y > fabs(ref->x - test->x);
|
||||
}
|
||||
};
|
||||
struct Diff: public Exp
|
||||
struct CardSelectorDiff: public Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
|
||||
{
|
||||
return ref != test;
|
||||
}
|
||||
};
|
||||
struct True: public Exp
|
||||
struct CardSelectorTrue: public Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target*, CardSelector::Target*)
|
||||
{
|
||||
@@ -94,7 +94,7 @@ void CardSelector::Remove(CardSelector::Target* card)
|
||||
CardView* c = dynamic_cast<CardView*> (active);
|
||||
if (c)
|
||||
c->zoom = 1.0f;
|
||||
active = closest<Diff> (cards, limitor, active);
|
||||
active = closest<CardSelectorDiff> (cards, limitor, active);
|
||||
c = dynamic_cast<CardView*> (active);
|
||||
if (c)
|
||||
c->zoom = 1.4f;
|
||||
@@ -120,7 +120,7 @@ CardSelector::Target* CardSelector::fetchMemory(SelectorMemory& memory)
|
||||
}
|
||||
// We come here if the card is not in the selector any more, or if
|
||||
// it is there but it is now refused by the limitor.
|
||||
return closest<True> (cards, limitor, memory.x, memory.y);
|
||||
return closest<CardSelectorTrue> (cards, limitor, memory.x, memory.y);
|
||||
}
|
||||
|
||||
void CardSelector::Push()
|
||||
@@ -182,7 +182,7 @@ bool CardSelector::CheckUserInput(JButton key)
|
||||
if(!jge) return false;
|
||||
if(jge->GetLeftClickCoordinates(x, y))
|
||||
{
|
||||
active = closest<True> (cards, limitor, static_cast<float> (x), static_cast<float> (y));
|
||||
active = closest<CardSelectorTrue> (cards, limitor, static_cast<float> (x), static_cast<float> (y));
|
||||
}
|
||||
|
||||
switch (key)
|
||||
@@ -196,16 +196,16 @@ bool CardSelector::CheckUserInput(JButton key)
|
||||
goto switch_active;
|
||||
break;
|
||||
case JGE_BTN_LEFT:
|
||||
active = closest<Left> (cards, limitor, active);
|
||||
active = closest<CardSelectorLeft> (cards, limitor, active);
|
||||
break;
|
||||
case JGE_BTN_RIGHT:
|
||||
active = closest<Right> (cards, limitor, active);
|
||||
active = closest<CardSelectorRight> (cards, limitor, active);
|
||||
break;
|
||||
case JGE_BTN_UP:
|
||||
active = closest<Up> (cards, limitor, active);
|
||||
active = closest<CardSelectorUp> (cards, limitor, active);
|
||||
break;
|
||||
case JGE_BTN_DOWN:
|
||||
active = closest<Down> (cards, limitor, active);
|
||||
active = closest<CardSelectorDown> (cards, limitor, active);
|
||||
break;
|
||||
case JGE_BTN_CANCEL:
|
||||
mDrawMode = (mDrawMode + 1) % DrawMode::kNumDrawModes;
|
||||
|
||||
@@ -13,16 +13,16 @@
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
namespace
|
||||
namespace DeckMenuConst
|
||||
{
|
||||
const float kVerticalMargin = 16;
|
||||
const float kHorizontalMargin = 20;
|
||||
const float kLineHeight = 25;
|
||||
const float kDescriptionVerticalBoxPadding = -5;
|
||||
const float kDescriptionVerticalBoxPadding = -5;
|
||||
const float kDescriptionHorizontalBoxPadding = 5;
|
||||
|
||||
const float kDefaultFontScale = 1.0f;
|
||||
const float kVerticalScrollSpeed = 7.0f;
|
||||
const float kVerticalScrollSpeed = 7.0f;
|
||||
|
||||
const int DETAILED_INFO_THRESHOLD = 20;
|
||||
const int kDetailedInfoButtonId = 10000;
|
||||
@@ -52,8 +52,8 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
|
||||
titleY = 15;
|
||||
titleWidth = 180; // width of inner box of title
|
||||
|
||||
descX = 260 + kDescriptionHorizontalBoxPadding;
|
||||
descY = 100 + kDescriptionVerticalBoxPadding;
|
||||
descX = 260 + DeckMenuConst::kDescriptionHorizontalBoxPadding;
|
||||
descY = 100 + DeckMenuConst::kDescriptionVerticalBoxPadding;
|
||||
descHeight = 145;
|
||||
descWidth = 195;
|
||||
|
||||
@@ -73,11 +73,11 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
|
||||
|
||||
float scrollerWidth = 200.0f;
|
||||
float scrollerHeight = 28.0f;
|
||||
mScroller = NEW VerticalTextScroller(Fonts::MAIN_FONT, 14, 235, scrollerWidth, scrollerHeight, kVerticalScrollSpeed);
|
||||
mScroller = NEW VerticalTextScroller(Fonts::MAIN_FONT, 14, 235, scrollerWidth, scrollerHeight, DeckMenuConst::kVerticalScrollSpeed);
|
||||
|
||||
mAutoTranslate = true;
|
||||
maxItems = 6;
|
||||
mHeight = 2 * kVerticalMargin + (maxItems * kLineHeight);
|
||||
mHeight = 2 * DeckMenuConst::kVerticalMargin + (maxItems * DeckMenuConst::kLineHeight);
|
||||
|
||||
// we want to cap the deck titles to 15 characters to avoid overflowing deck names
|
||||
title = _(_title);
|
||||
@@ -94,7 +94,7 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
|
||||
else
|
||||
titleFontScale = SCALE_NORMAL;
|
||||
|
||||
mSelectionTargetY = selectionY = kVerticalMargin;
|
||||
mSelectionTargetY = selectionY = DeckMenuConst::kVerticalMargin;
|
||||
|
||||
if (NULL == stars)
|
||||
stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars").get()));
|
||||
@@ -106,7 +106,7 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
|
||||
float stringWidth = descriptionFont->GetStringWidth(detailedInfoString.c_str());
|
||||
float boxStartX = detailedInfoBoxX - stringWidth / 2 + 20;
|
||||
|
||||
dismissButton = NEW InteractiveButton( this, kDetailedInfoButtonId, Fonts::MAIN_FONT, detailedInfoString, boxStartX, detailedInfoBoxY, JGE_BTN_CANCEL);
|
||||
dismissButton = NEW InteractiveButton( this, DeckMenuConst::kDetailedInfoButtonId, Fonts::MAIN_FONT, detailedInfoString, boxStartX, detailedInfoBoxY, JGE_BTN_CANCEL);
|
||||
JGuiController::Add(dismissButton, true);
|
||||
|
||||
updateScroller();
|
||||
@@ -181,7 +181,7 @@ bool DeckMenu::showDetailsScreen()
|
||||
if (currentMenuItem)
|
||||
{
|
||||
if (mAlwaysShowDetailsButton) return true;
|
||||
if (mShowDetailsScreen && currentMenuItem->getVictories() > DETAILED_INFO_THRESHOLD) return true;
|
||||
if (mShowDetailsScreen && currentMenuItem->getVictories() > DeckMenuConst::DETAILED_INFO_THRESHOLD) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -189,10 +189,10 @@ bool DeckMenu::showDetailsScreen()
|
||||
|
||||
void DeckMenu::initMenuItems()
|
||||
{
|
||||
float sY = mY + kVerticalMargin;
|
||||
float sY = mY + DeckMenuConst::kVerticalMargin;
|
||||
for (int i = startId; i < mCount; ++i)
|
||||
{
|
||||
float y = mY + kVerticalMargin + i * kLineHeight;
|
||||
float y = mY + DeckMenuConst::kVerticalMargin + i * DeckMenuConst::kLineHeight;
|
||||
DeckMenuItem * currentMenuItem = static_cast<DeckMenuItem*> (mObjects[i]);
|
||||
currentMenuItem->Relocate(mX, y);
|
||||
if (currentMenuItem->hasFocus()) sY = y;
|
||||
@@ -248,7 +248,7 @@ void DeckMenu::Render()
|
||||
{
|
||||
if (i > mCount - 1) break;
|
||||
DeckMenuItem *currentMenuItem = static_cast<DeckMenuItem*> (mObjects[i]);
|
||||
if (currentMenuItem->getY() - kLineHeight * startId < mY + height - kLineHeight + 7)
|
||||
if (currentMenuItem->getY() - DeckMenuConst::kLineHeight * startId < mY + height - DeckMenuConst::kLineHeight + 7)
|
||||
{
|
||||
// only load stats for visible items in the list
|
||||
DeckMetaData* metaData = currentMenuItem->getMetaData();
|
||||
@@ -293,6 +293,7 @@ void DeckMenu::Render()
|
||||
|
||||
// fill in the description part of the screen
|
||||
string text = wordWrap(_(currentMenuItem->getDescription()), descWidth, descriptionFont->mFontID );
|
||||
descriptionFont->SetColor(ARGB(255,255,255,255));
|
||||
descriptionFont->DrawString(text.c_str(), descX, descY);
|
||||
|
||||
// fill in the statistical portion
|
||||
@@ -301,6 +302,7 @@ void DeckMenu::Render()
|
||||
ostringstream oss;
|
||||
oss << _("Deck: ") << currentMenuItem->getDeckName() << endl;
|
||||
oss << currentMenuItem->getDeckStatsSummary();
|
||||
descriptionFont->SetColor(ARGB(255,255,255,255));
|
||||
descriptionFont->DrawString(oss.str(), statsX, statsY);
|
||||
}
|
||||
|
||||
@@ -309,7 +311,7 @@ void DeckMenu::Render()
|
||||
}
|
||||
else // reset the font color to be slightly muted
|
||||
mFont->SetColor(ARGB(150,255,255,255));
|
||||
currentMenuItem->RenderWithOffset(-kLineHeight * startId);
|
||||
currentMenuItem->RenderWithOffset(-DeckMenuConst::kLineHeight * startId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,8 +344,8 @@ void DeckMenu::Update(float dt)
|
||||
selectionT += 3 * dt;
|
||||
selectionY += (mSelectionTargetY - selectionY) * 8 * dt;
|
||||
|
||||
float starsX = starsOffsetX + ((mWidth - 2 * kHorizontalMargin) * (1 + cos(selectionT)) / 2);
|
||||
float starsY = selectionY + 5 * cos(selectionT * 2.35f) + kLineHeight / 2 - kLineHeight * startId;
|
||||
float starsX = starsOffsetX + ((mWidth - 2 * DeckMenuConst::kHorizontalMargin) * (1 + cos(selectionT)) / 2);
|
||||
float starsY = selectionY + 5 * cos(selectionT * 2.35f) + DeckMenuConst::kLineHeight / 2 - DeckMenuConst::kLineHeight * startId;
|
||||
stars->MoveTo(starsX, starsY);
|
||||
|
||||
//
|
||||
@@ -371,7 +373,7 @@ void DeckMenu::Update(float dt)
|
||||
void DeckMenu::Add(int id, const char * text, string desc, bool forceFocus, DeckMetaData * deckMetaData)
|
||||
{
|
||||
DeckMenuItem * menuItem = NEW DeckMenuItem(this, id, fontId, text, 0,
|
||||
mY + kVerticalMargin + mCount * kLineHeight, (mCount == 0), mAutoTranslate, deckMetaData);
|
||||
mY + DeckMenuConst::kVerticalMargin + mCount * DeckMenuConst::kLineHeight, (mCount == 0), mAutoTranslate, deckMetaData);
|
||||
Translator * t = Translator::GetInstance();
|
||||
map<string, string>::iterator it = t->deckValues.find(text);
|
||||
string deckDescription = "";
|
||||
@@ -384,7 +386,7 @@ void DeckMenu::Add(int id, const char * text, string desc, bool forceFocus, Deck
|
||||
menuItem->setDescription(deckDescription);
|
||||
|
||||
JGuiController::Add(menuItem);
|
||||
if (mCount <= maxItems) mHeight += kLineHeight;
|
||||
if (mCount <= maxItems) mHeight += DeckMenuConst::kLineHeight;
|
||||
|
||||
if (forceFocus)
|
||||
{
|
||||
|
||||
@@ -271,22 +271,6 @@ void DeckStats::EndInstance()
|
||||
|
||||
|
||||
// StatsWrapper
|
||||
|
||||
float noLandsProbInTurn[Constants::STATS_FOR_TURNS] = {0.0f};
|
||||
float noCreaturesProbInTurn[Constants::STATS_FOR_TURNS] = {0.0f};
|
||||
|
||||
int countCardsPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1] = {{0,0}};
|
||||
int countCreaturesPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1] = {{0,0}};
|
||||
int countSpellsPerCostAndColor[Constants::STATS_MAX_MANA_COST + 1][Constants::MTG_NB_COLORS + 1] = {{0,0}};
|
||||
|
||||
int countCardsPerCost[Constants::STATS_MAX_MANA_COST + 1] = {0};
|
||||
int countCreaturesPerCost[Constants::STATS_MAX_MANA_COST + 1] = {0};
|
||||
int countSpellsPerCost[Constants::STATS_MAX_MANA_COST + 1] = {0};
|
||||
int countLandsPerColor[Constants::MTG_NB_COLORS + 1] = {0};
|
||||
int countBasicLandsPerColor[Constants::MTG_NB_COLORS + 1] = {0};
|
||||
int countNonLandProducersPerColor[Constants::MTG_NB_COLORS + 1] = {0};
|
||||
int totalCostPerColor[Constants::MTG_NB_COLORS + 1] = {0};
|
||||
|
||||
void StatsWrapper::initValues()
|
||||
{
|
||||
// initilize all member values to 0
|
||||
@@ -301,7 +285,24 @@ void StatsWrapper::initValues()
|
||||
avgManaCost = avgCreatureCost = avgSpellCost = 0.0f;
|
||||
|
||||
countCreatures = countSpells = countInstants = countEnchantments = countSorceries = countArtifacts = 0;
|
||||
|
||||
|
||||
//this works only with 0.0f on floats
|
||||
memset(noLandsProbInTurn, 0.0f, sizeof(float) * Constants::STATS_FOR_TURNS);
|
||||
memset(noCreaturesProbInTurn, 0.0f, sizeof(float) * Constants::STATS_FOR_TURNS);
|
||||
|
||||
memset(countCardsPerCost, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1));
|
||||
memset(countCreaturesPerCost, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1));
|
||||
memset(countSpellsPerCost, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1));
|
||||
|
||||
memset(countCardsPerCostAndColor, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1)*(Constants::MTG_NB_COLORS + 1));
|
||||
memset(countCreaturesPerCostAndColor, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1)*(Constants::MTG_NB_COLORS + 1));
|
||||
memset(countSpellsPerCostAndColor, 0, sizeof(int) * (Constants::STATS_MAX_MANA_COST + 1)*(Constants::MTG_NB_COLORS + 1));
|
||||
|
||||
memset(countLandsPerColor, 0, sizeof(int) * (Constants::MTG_NB_COLORS + 1));
|
||||
memset(countBasicLandsPerColor, 0, sizeof(int) * (Constants::MTG_NB_COLORS + 1));
|
||||
memset(countNonLandProducersPerColor, 0, sizeof(int) * (Constants::MTG_NB_COLORS + 1));
|
||||
memset(totalCostPerColor, 0, sizeof(int) * (Constants::MTG_NB_COLORS + 1));
|
||||
|
||||
}
|
||||
|
||||
StatsWrapper::StatsWrapper(int deckId)
|
||||
|
||||
@@ -21,7 +21,7 @@ enum ENUM_AWARDS_STATE
|
||||
|
||||
};
|
||||
|
||||
namespace
|
||||
namespace GameStateAwardsConst
|
||||
{
|
||||
const int kBackToTrophiesID = 2;
|
||||
const int kBackToMainMenuID = 1;
|
||||
@@ -186,8 +186,8 @@ void GameStateAwards::Update(float dt)
|
||||
SAFE_DELETE(menu);
|
||||
menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), EXIT_AWARDS_MENU, this, Fonts::MENU_FONT, 50, 170);
|
||||
if (mState == STATE_DETAILS)
|
||||
menu->Add(kBackToTrophiesID, "Back to Trophies");
|
||||
menu->Add(kBackToMainMenuID, "Back to Main Menu");
|
||||
menu->Add(GameStateAwardsConst::kBackToTrophiesID, "Back to Trophies");
|
||||
menu->Add(GameStateAwardsConst::kBackToMainMenuID, "Back to Main Menu");
|
||||
menu->Add(kCancelMenuID, "Cancel");
|
||||
break;
|
||||
case JGE_BTN_PREV:
|
||||
@@ -359,11 +359,11 @@ void GameStateAwards::ButtonPressed(int controllerId, int controlId)
|
||||
if (controllerId == EXIT_AWARDS_MENU)
|
||||
switch (controlId)
|
||||
{
|
||||
case kBackToMainMenuID:
|
||||
case GameStateAwardsConst::kBackToMainMenuID:
|
||||
mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU);
|
||||
showMenu = false;
|
||||
break;
|
||||
case kBackToTrophiesID:
|
||||
case GameStateAwardsConst::kBackToTrophiesID:
|
||||
mState = STATE_LISTVIEW;
|
||||
SAFE_DELETE(detailview);
|
||||
showMenu = false;
|
||||
|
||||
@@ -7,13 +7,12 @@
|
||||
#include "SimplePad.h"
|
||||
#include "Translate.h"
|
||||
|
||||
namespace
|
||||
namespace GameStateOptionsConst
|
||||
{
|
||||
const int kSaveAndBackToMainMenuID = 1;
|
||||
const int kBackToMainMenuID = 2;
|
||||
const int kNewProfileID = 4;
|
||||
const int kReloadID = 5;
|
||||
|
||||
}
|
||||
|
||||
GameStateOptions::GameStateOptions(GameApp* parent) :
|
||||
@@ -78,7 +77,7 @@ void GameStateOptions::Start()
|
||||
|
||||
optionsList->Add(NEW WGuiSplit(cPrf, cThm));
|
||||
optionsList->Add(cStyle);
|
||||
optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, kNewProfileID, this));
|
||||
optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, GameStateOptionsConst::kNewProfileID, this));
|
||||
|
||||
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable Cheat Mode")));
|
||||
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::OPTIMIZE_HAND, "Optimize Starting Hand")));
|
||||
@@ -118,8 +117,8 @@ void GameStateOptions::Start()
|
||||
optionsTabs->Add(optionsList);
|
||||
|
||||
optionsMenu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), -102, this, Fonts::MAIN_FONT, 50, 170);
|
||||
optionsMenu->Add(kBackToMainMenuID, "Back to Main Menu");
|
||||
optionsMenu->Add(kSaveAndBackToMainMenuID, "Save And Exit");
|
||||
optionsMenu->Add(GameStateOptionsConst::kBackToMainMenuID, "Back to Main Menu");
|
||||
optionsMenu->Add(GameStateOptionsConst::kSaveAndBackToMainMenuID, "Save And Exit");
|
||||
optionsMenu->Add(kCancelMenuID, "Cancel");
|
||||
|
||||
optionsTabs->Entering(JGE_BTN_NONE);
|
||||
@@ -285,21 +284,21 @@ void GameStateOptions::ButtonPressed(int controllerId, int controlId)
|
||||
if (controllerId == -102)
|
||||
switch (controlId)
|
||||
{
|
||||
case kSaveAndBackToMainMenuID:
|
||||
case GameStateOptionsConst::kSaveAndBackToMainMenuID:
|
||||
mState = SAVE;
|
||||
break;
|
||||
//Set Audio volume
|
||||
case kBackToMainMenuID:
|
||||
case GameStateOptionsConst::kBackToMainMenuID:
|
||||
mParent->DoTransition(TRANSITION_FADE, GAME_STATE_MENU);
|
||||
break;
|
||||
case kCancelMenuID:
|
||||
mState = SHOW_OPTIONS;
|
||||
break;
|
||||
case kNewProfileID:
|
||||
case GameStateOptionsConst::kNewProfileID:
|
||||
options.keypadStart("", &newProfile);
|
||||
options.keypadTitle("New Profile");
|
||||
break;
|
||||
case kReloadID:
|
||||
case GameStateOptionsConst::kReloadID:
|
||||
mReload = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -16,21 +16,21 @@ const float kZoom_level1 = 1.4f;
|
||||
const float kZoom_level2 = 2.2f;
|
||||
const float kZoom_level3 = 2.7f;
|
||||
|
||||
struct True: public Exp
|
||||
struct GuiCombatTrue: public Exp
|
||||
{
|
||||
static inline bool test(DamagerDamaged*, DamagerDamaged*)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
struct Left: public Exp
|
||||
struct GuiCombatLeft: public Exp
|
||||
{
|
||||
static inline bool test(DamagerDamaged* ref, DamagerDamaged* test)
|
||||
{
|
||||
return ref->y == test->y && ref->x > test->x && test->show;
|
||||
}
|
||||
};
|
||||
struct Right: public Exp
|
||||
struct GuiCombatRight: public Exp
|
||||
{
|
||||
static inline bool test(DamagerDamaged* ref, DamagerDamaged* test)
|
||||
{
|
||||
@@ -217,7 +217,7 @@ void GuiCombat::shiftLeft()
|
||||
case ATK:
|
||||
{
|
||||
DamagerDamaged* old = active;
|
||||
active = closest<Left> (attackers, NULL, static_cast<AttackerDamaged*> (active));
|
||||
active = closest<GuiCombatLeft> (attackers, NULL, static_cast<AttackerDamaged*> (active));
|
||||
activeAtk = static_cast<AttackerDamaged*> (active);
|
||||
if (old != active)
|
||||
{
|
||||
@@ -231,7 +231,7 @@ void GuiCombat::shiftLeft()
|
||||
case BLK:
|
||||
{
|
||||
DamagerDamaged* old = active;
|
||||
active = closest<Left> (activeAtk->blockers, NULL, static_cast<DefenserDamaged*> (active));
|
||||
active = closest<GuiCombatLeft> (activeAtk->blockers, NULL, static_cast<DefenserDamaged*> (active));
|
||||
if (old != active)
|
||||
{
|
||||
if (old)
|
||||
@@ -255,7 +255,7 @@ void GuiCombat::shiftRight( DamagerDamaged* oldActive )
|
||||
case BLK:
|
||||
{
|
||||
DamagerDamaged* old = active;
|
||||
active = closest<Right> (activeAtk->blockers, NULL, static_cast<DefenserDamaged*> (active));
|
||||
active = closest<GuiCombatRight> (activeAtk->blockers, NULL, static_cast<DefenserDamaged*> (active));
|
||||
if (old != active)
|
||||
{
|
||||
if (old)
|
||||
@@ -268,7 +268,7 @@ void GuiCombat::shiftRight( DamagerDamaged* oldActive )
|
||||
case ATK:
|
||||
{
|
||||
DamagerDamaged* old = active;
|
||||
active = closest<Right> (attackers, NULL, static_cast<AttackerDamaged*> (active));
|
||||
active = closest<GuiCombatRight> (attackers, NULL, static_cast<AttackerDamaged*> (active));
|
||||
if (active == oldActive)
|
||||
{
|
||||
active = activeAtk = NULL;
|
||||
@@ -321,7 +321,7 @@ bool GuiCombat::CheckUserInput(JButton key)
|
||||
// position selected card
|
||||
if (BLK == cursor_pos)
|
||||
{
|
||||
DamagerDamaged* selectedCard = closest<True> (activeAtk->blockers, NULL, static_cast<float> (x), static_cast<float> (y));
|
||||
DamagerDamaged* selectedCard = closest<GuiCombatTrue> (activeAtk->blockers, NULL, static_cast<float> (x), static_cast<float> (y));
|
||||
// find the index into the vector where the current selected card is.
|
||||
int c1 = 0, c2 = 0;
|
||||
int i = 0;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "GameApp.h"
|
||||
#include "Translate.h"
|
||||
|
||||
namespace
|
||||
namespace SimpleMenuConst
|
||||
{
|
||||
const float kPoleWidth = 7;
|
||||
const float kVerticalMargin = 20;
|
||||
@@ -38,7 +38,7 @@ SimpleMenu::SimpleMenu(JGE* jge, WResourceManager* resourceManager, int id, JGui
|
||||
{
|
||||
autoTranslate = true;
|
||||
isMultipleChoice = false;
|
||||
mHeight = 2 * kVerticalMargin;
|
||||
mHeight = 2 * SimpleMenuConst::kVerticalMargin;
|
||||
mWidth = 0;
|
||||
mX = x;
|
||||
mY = y;
|
||||
@@ -48,7 +48,7 @@ SimpleMenu::SimpleMenu(JGE* jge, WResourceManager* resourceManager, int id, JGui
|
||||
selectionT = 0;
|
||||
timeOpen = 0;
|
||||
mClosed = false;
|
||||
selectionTargetY = selectionY = y + kVerticalMargin;
|
||||
selectionTargetY = selectionY = y + SimpleMenuConst::kVerticalMargin;
|
||||
|
||||
if(resourceManager)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ SimpleMenu::SimpleMenu(JGE* jge, WResourceManager* resourceManager, int id, JGui
|
||||
spadeL = resourceManager->RetrieveQuad("spade_ul.png", 0, 0, 0, 0, "spade_ul", RETRIEVE_MANAGE);
|
||||
spadeR = resourceManager->RetrieveQuad("spade_ur.png", 0, 0, 0, 0, "spade_ur", RETRIEVE_MANAGE);
|
||||
jewel.reset(NEW JQuad(jewelTex, 1, 1, 3, 3));
|
||||
side = resourceManager->RetrieveQuad("menuside.png", 1, 1, 1, kPoleWidth, "menuside", RETRIEVE_MANAGE);
|
||||
side = resourceManager->RetrieveQuad("menuside.png", 1, 1, 1, SimpleMenuConst::kPoleWidth, "menuside", RETRIEVE_MANAGE);
|
||||
|
||||
stars = NEW hgeParticleSystem(resourceManager->RetrievePSI("stars.psi", resourceManager->GetQuad("stars").get()));
|
||||
|
||||
@@ -78,16 +78,16 @@ void SimpleMenu::drawHorzPole(float x, float y, float width)
|
||||
{
|
||||
JRenderer* renderer = JRenderer::GetInstance();
|
||||
|
||||
float leftXOffset = (spadeR->mWidth - kPoleWidth) / 2;
|
||||
float leftXOffset = (spadeR->mWidth - SimpleMenuConst::kPoleWidth) / 2;
|
||||
float rightXOffset = leftXOffset;
|
||||
float yOffset = leftXOffset;
|
||||
if (spadeR->mWidth != spadeR->mHeight)
|
||||
{
|
||||
//We have a weird case to deal with in the "Classic" theme, the spades graphics need to be aligned specifically,
|
||||
// While the ones in the "Final Saga" theme need to be centered
|
||||
leftXOffset = kSpadeWidthOffset;
|
||||
yOffset = kSpadeHeightOffset;
|
||||
rightXOffset = kSpadeRightBottomOffset;
|
||||
leftXOffset = SimpleMenuConst::kSpadeWidthOffset;
|
||||
yOffset = SimpleMenuConst::kSpadeHeightOffset;
|
||||
rightXOffset = SimpleMenuConst::kSpadeRightBottomOffset;
|
||||
}
|
||||
|
||||
renderer->RenderQuad(side.get(), x, y, 0, width);
|
||||
@@ -104,23 +104,23 @@ void SimpleMenu::drawVertPole(float x, float y, float height)
|
||||
{
|
||||
JRenderer* renderer = JRenderer::GetInstance();
|
||||
|
||||
float xOffset = (spadeR->mWidth - kPoleWidth) / 2;
|
||||
float xOffset = (spadeR->mWidth - SimpleMenuConst::kPoleWidth) / 2;
|
||||
float topYOffset = xOffset;
|
||||
float bottomYOffset = xOffset;
|
||||
if (spadeR->mWidth != spadeR->mHeight)
|
||||
{
|
||||
//We have a weird case to deal with in the "Classic" theme, the spades graphics need to be aligned specifically,
|
||||
// While the ones in the "Final Saga" theme need to be centered
|
||||
xOffset = kSpadeHeightOffset;
|
||||
topYOffset = kSpadeWidthOffset;
|
||||
bottomYOffset = kSpadeRightBottomOffset;
|
||||
xOffset = SimpleMenuConst::kSpadeHeightOffset;
|
||||
topYOffset = SimpleMenuConst::kSpadeWidthOffset;
|
||||
bottomYOffset = SimpleMenuConst::kSpadeRightBottomOffset;
|
||||
}
|
||||
|
||||
renderer->RenderQuad(side.get(), x + kPoleWidth, y, M_PI / 2, height);
|
||||
renderer->RenderQuad(side.get(), x + SimpleMenuConst::kPoleWidth, y, M_PI / 2, height);
|
||||
spadeR->SetHFlip(true);
|
||||
spadeL->SetHFlip(false);
|
||||
renderer->RenderQuad(spadeR.get(), x + kPoleWidth + xOffset, y - topYOffset, M_PI / 2);
|
||||
renderer->RenderQuad(spadeL.get(), x + kPoleWidth + xOffset, y + height - bottomYOffset, M_PI / 2);
|
||||
renderer->RenderQuad(spadeR.get(), x + SimpleMenuConst::kPoleWidth + xOffset, y - topYOffset, M_PI / 2);
|
||||
renderer->RenderQuad(spadeL.get(), x + SimpleMenuConst::kPoleWidth + xOffset, y + height - bottomYOffset, M_PI / 2);
|
||||
|
||||
renderer->RenderQuad(jewel.get(), x - 1, y - 1);
|
||||
renderer->RenderQuad(jewel.get(), x - 1, y + height - 1);
|
||||
@@ -133,7 +133,7 @@ void SimpleMenu::Render()
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
|
||||
if (0 == mWidth)
|
||||
{
|
||||
float sY = mY + kVerticalMargin;
|
||||
float sY = mY + SimpleMenuConst::kVerticalMargin;
|
||||
|
||||
for (int i = 0; i < mCount; ++i)
|
||||
{
|
||||
@@ -146,7 +146,7 @@ void SimpleMenu::Render()
|
||||
if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str())))
|
||||
mWidth = titleFont->GetStringWidth(title.c_str());
|
||||
titleFont->SetScale(scaleFactor);
|
||||
mWidth += 2 * kHorizontalMargin;
|
||||
mWidth += 2 * SimpleMenuConst::kHorizontalMargin;
|
||||
|
||||
if (mCenterHorizontal)
|
||||
mX = (SCREEN_WIDTH_F - mWidth) / 2;
|
||||
@@ -156,7 +156,7 @@ void SimpleMenu::Render()
|
||||
|
||||
for (int i = 0; i < mCount; ++i)
|
||||
{
|
||||
float y = mY + kVerticalMargin + i * kLineHeight;
|
||||
float y = mY + SimpleMenuConst::kVerticalMargin + i * SimpleMenuConst::kLineHeight;
|
||||
SimpleMenuItem * smi = static_cast<SimpleMenuItem*> (mObjects[i]);
|
||||
smi->Relocate(mX + mWidth / 2, y);
|
||||
if (smi->hasFocus()) sY = y;
|
||||
@@ -171,7 +171,7 @@ void SimpleMenu::Render()
|
||||
float height = mHeight;
|
||||
if (timeOpen < 1) height *= timeOpen > 0 ? timeOpen : -timeOpen;
|
||||
|
||||
float heightPadding = kLineHeight/2; // this to reduce the bottom padding of the menu
|
||||
float heightPadding = SimpleMenuConst::kLineHeight/2; // this to reduce the bottom padding of the menu
|
||||
renderer->FillRect(mX, mY, mWidth, height - heightPadding, ARGB(180,0,0,0));
|
||||
|
||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
||||
@@ -200,8 +200,8 @@ void SimpleMenu::Render()
|
||||
{
|
||||
if (i > mCount - 1) break;
|
||||
SimpleMenuItem *currentMenuItem = static_cast<SimpleMenuItem*>(mObjects[i]);
|
||||
float currentY = currentMenuItem->getY() - kLineHeight * startId;
|
||||
float menuBottomEdge = mY + height - kLineHeight + 7;
|
||||
float currentY = currentMenuItem->getY() - SimpleMenuConst::kLineHeight * startId;
|
||||
float menuBottomEdge = mY + height - SimpleMenuConst::kLineHeight + 7;
|
||||
if (currentY < menuBottomEdge)
|
||||
{
|
||||
if (currentMenuItem->hasFocus())
|
||||
@@ -214,7 +214,7 @@ void SimpleMenu::Render()
|
||||
{
|
||||
mFont->SetColor(ARGB(150,255,255,255));
|
||||
}
|
||||
(static_cast<SimpleMenuItem*> (mObjects[i]))->RenderWithOffset(-kLineHeight * startId);
|
||||
(static_cast<SimpleMenuItem*> (mObjects[i]))->RenderWithOffset(-SimpleMenuConst::kLineHeight * startId);
|
||||
}
|
||||
mFont->SetScale(SCALE_NORMAL);
|
||||
}
|
||||
@@ -244,8 +244,8 @@ bool SimpleMenu::CheckUserInput(JButton key)
|
||||
if (mObjects.size())
|
||||
{
|
||||
float top, left;
|
||||
float menuTopEdge = mY + kLineHeight;
|
||||
float menuBottomEdge = mY + mHeight - (kLineHeight/2);
|
||||
float menuTopEdge = mY + SimpleMenuConst::kLineHeight;
|
||||
float menuBottomEdge = mY + mHeight - (SimpleMenuConst::kLineHeight/2);
|
||||
|
||||
if (y < menuTopEdge)
|
||||
n = (mCurr - 1) > 0 ? mCurr -1 : 0;
|
||||
@@ -257,7 +257,7 @@ bool SimpleMenu::CheckUserInput(JButton key)
|
||||
{
|
||||
if (mObjects[i]->getTopLeft(top, left))
|
||||
{
|
||||
if ( (y > top) && (y <= (top + kLineHeight)) )
|
||||
if ( (y > top) && (y <= (top + SimpleMenuConst::kLineHeight)) )
|
||||
n = i;
|
||||
}
|
||||
}
|
||||
@@ -308,8 +308,8 @@ void SimpleMenu::Update(float dt)
|
||||
selectionT += 3 * dt;
|
||||
selectionY += (selectionTargetY - selectionY) * 8 * dt;
|
||||
if(stars)
|
||||
stars->MoveTo(mX + kHorizontalMargin + ((mWidth - 2 * kHorizontalMargin) * (1 + cos(selectionT)) / 2), selectionY + 5 * cos(
|
||||
selectionT * 2.35f) + kLineHeight / 2 - kLineHeight * startId);
|
||||
stars->MoveTo(mX + SimpleMenuConst::kHorizontalMargin + ((mWidth - 2 * SimpleMenuConst::kHorizontalMargin) * (1 + cos(selectionT)) / 2), selectionY + 5 * cos(
|
||||
selectionT * 2.35f) + SimpleMenuConst::kLineHeight / 2 - SimpleMenuConst::kLineHeight * startId);
|
||||
if (timeOpen < 0)
|
||||
{
|
||||
timeOpen += dt * 10;
|
||||
@@ -330,12 +330,12 @@ void SimpleMenu::Update(float dt)
|
||||
|
||||
void SimpleMenu::Add(int id, const char * text, string desc, bool forceFocus)
|
||||
{
|
||||
SimpleMenuItem * smi = NEW SimpleMenuItem(this, id, fontId, text, 0, mY + kVerticalMargin + mCount * kLineHeight,
|
||||
SimpleMenuItem * smi = NEW SimpleMenuItem(this, id, fontId, text, 0, mY + SimpleMenuConst::kVerticalMargin + mCount * SimpleMenuConst::kLineHeight,
|
||||
(mCount == 0), autoTranslate);
|
||||
|
||||
smi->setDescription(desc);
|
||||
JGuiController::Add(smi);
|
||||
if (mCount <= maxItems) mHeight += kLineHeight;
|
||||
if (mCount <= maxItems) mHeight += SimpleMenuConst::kLineHeight;
|
||||
if (forceFocus)
|
||||
{
|
||||
mObjects[mCurr]->Leaving(JGE_BTN_DOWN);
|
||||
|
||||
@@ -7,9 +7,15 @@ cd ..
|
||||
cd projects/mtg
|
||||
mkdir objs
|
||||
make -j 8
|
||||
cd ../..
|
||||
|
||||
# we're building an Android binary here
|
||||
android-ndk-r9/ndk-build -C projects/mtg/Android -j8
|
||||
$ANDROID list targets
|
||||
$ANDROID update project -t 1 -p projects/mtg/Android
|
||||
ant debug -f projects/mtg/Android/build.xml
|
||||
|
||||
# let's try an Intel linux binary
|
||||
cd ../..
|
||||
qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_STDERR
|
||||
make -j 8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user