114 Commits

Author SHA1 Message Date
Dmitry Panin
0bb6cf4a4a Removing previous releases in order to upload new one 2013-12-12 01:53:46 +04:00
Dmitry Panin
8691e7e2c7 Excluding tag latest-master from build 2013-12-12 01:26:23 +04:00
Dmitry Panin
8717e148bf One more test upload 2013-12-12 01:12:55 +04:00
Dmitry Panin
9faca83e18 changed git tag 2013-12-12 00:18:59 +04:00
Dmitry Panin
fd081c4ad2 hacking releases 2013-12-11 23:58:00 +04:00
Tobias Loose
5d92553017 Fix bug where the phase wheel got out of sync
The phase wheel messures phases within another unit and not
mtg phases. It is important to map between those
2013-12-11 01:53:05 +01:00
xawotihs
f0e6d820c7 Fixed GuiPhaseBar logics. 2013-12-10 22:23:28 +01:00
xawotihs
545fc21260 Merge branch 'more_easing' of https://github.com/ZobyTwo/wagic into ZobyTwo-more_easing 2013-12-10 20:35:47 +01:00
Xawotihs
8b68568106 Merge pull request #585 from bjornsnoen/master
Added Avatar Tokens created by Ajani Goldmane.
2013-12-10 11:12:33 -08:00
xawotihs
739a5d9e2b Removed env traces and change the secure token as it was exposed. 2013-12-09 22:39:25 +01:00
Tobias Loose
4c627f74b6 Add easing to GuiPhaseBar, simplify math a bit. 2013-12-09 22:20:43 +01:00
Tobias Loose
1e610ff653 Add InQuadEasing and OutQuadEasing and make tasklists...
easing more natural
2013-12-09 22:20:43 +01:00
Tobias Loose
5d6557a49f Add easing to task list and fix a bug where
opening the task list a second time was not possible
2013-12-09 22:20:43 +01:00
xawotihs
7528329a58 Add more debug in travis script 2013-12-09 21:54:55 +01:00
xawotihs
c62597dce5 Add some debugging to Travis script 2013-12-09 21:43:26 +01:00
Xawotihs
d8dfcdba67 Merge pull request #583 from ZobyTwo/deck_viewer_1
Cleanup, usability fixes and source code documentation for DeckView.h and GridDeckView.h
2013-12-09 11:51:40 -08:00
Bjørn Snoen
7b5f00260b Added Avatar Tokens created by Ajani Goldmane. 2013-12-09 16:55:31 +01:00
Tobias Loose
f9dc551942 Fix logic error in grid view 2013-12-08 23:05:06 +01:00
Tobias Loose
718ceca919 Do not allow that the selection moves outside in grid view. 2013-12-08 22:43:03 +01:00
xawotihs
89fb76a8e7 Updated scripts to remove any modified artifacts from Res directory.
Not doing it causes side effects on the testsuite.
2013-12-08 12:16:25 +01:00
Tobias Loose
1cc65ab611 Enable rotating over multiple filters, add src code doc 2013-12-08 12:03:13 +01:00
xawotihs
3b22354ad9 Fixed testsuite 2013-12-08 11:36:18 +01:00
Tobias Loose
2b9977a334 Rename methods for consistency and add source code doc
to DeckView.h
2013-12-08 10:48:15 +01:00
Tobias Loose
12c5f31562 Add a buttonMode to grid view to enable it on pointerless devices. 2013-12-08 09:11:44 +01:00
xawotihs
8cfd887375 Fixed upload script 2013-12-08 01:10:29 +01:00
xawotihs
292bf7b1d2 Merge branch 'ci_upload_binaries' 2013-12-08 00:33:42 +01:00
xawotihs
4041fe690b Create a release and parse its ID using jq. 2013-12-08 00:16:52 +01:00
xawotihs
cb73e2b90d Merge branch 'master' into ci_upload_binaries
Fixed Windows compilation.
2013-12-07 22:08:54 +01:00
ZobyTwo
a1fa36a934 Merge pull request #578 from ZobyTwo/deck_viewer_1
Reset positions and filters when reopening the editor. These changes are trivial so I will merge them.
2013-12-07 11:53:16 -08:00
Tobias Loose
bdd0e6c042 Reset positions and filters when reopening the editor 2013-12-07 20:47:50 +01:00
xawotihs
ee217e94a8 Fixed carousel pull request with Visual Studio. 2013-12-07 20:29:42 +01:00
xawotihs
38e19f7d35 Removed mingw32-qt
Merged SDL and QT .pro files
Removed glu dependency in corewrapper and JGfx to enable mingw cross compilation.
2013-12-07 18:57:57 +01:00
xawotihs
0bbfd00d15 Tries to install mingw32-qt on Travis 2013-12-07 18:31:02 +01:00
Tobias Loose
aaceb3c038 Remove unused declaration 2013-12-07 13:33:16 +01:00
Tobias Loose
5efa7e10bd Remove test debug output. Fix HUD fading. 2013-12-07 13:01:14 +01:00
Tobias Loose
14c164364e Cleanups and state reduction.
This mainly moves datamembers around and tries to avoid caching of
results of calculations when the calculations are cheap.
2013-12-07 12:58:20 +01:00
Tobias Loose
4514725aba Make the eased value a reference and add source code doc to Easing.h
This allows to apply multiple easings to the same variable.
2013-12-07 10:05:26 +01:00
Tobias Loose
2b0f50bb88 Remove redundancy and make control flow a bit simpler 2013-12-07 09:04:24 +01:00
xawotihs
a65fc0c0f0 Merge branch 'master' into ci_upload_binaries
sudo pip installation of pyjavaproperties
2013-12-06 22:52:32 +01:00
xawotihs
99db363253 Uses pip to install pyjavaproperties 2013-12-06 22:41:09 +01:00
xawotihs
c25dfec67e Fixed python module installation 2013-12-06 22:17:19 +01:00
xawotihs
dd7210d187 Install pyjavaproperties in travis. 2013-12-06 21:59:29 +01:00
xawotihs
904b7a6d86 Build and upload core resource package 2013-12-06 21:21:01 +01:00
Tobias Loose
31b353c5ec Use easing within the carousel view sliding 2013-12-06 21:04:21 +01:00
Tobias Loose
0d350af1b6 Use easing within the carousel views scrolling
It is visible if you scroll more than one card
2013-12-06 20:51:18 +01:00
xawotihs
3bc9c93bab Build and upload PSP binary archive. 2013-12-06 20:40:02 +01:00
Tobias Loose
2002bb4e16 Fix crash that occured when opening the editor a second time 2013-12-06 20:13:30 +01:00
Tobias Loose
7e9c4ddbdd Fix logic error in optimization introduced in last commit 2013-12-06 19:53:38 +01:00
Tobias Loose
12b71de63c Render small cards as thumbnails 2013-12-06 19:51:42 +01:00
Tobias Loose
15011961f4 Do only prefetch cards if resource management is threaded 2013-12-06 16:43:09 +01:00
xawotihs
b851103711 Commented out the release creation and refered an existing release instead. 2013-12-06 00:47:24 +01:00
xawotihs
67b8af8d15 Merge branch 'ci_upload_binaries' of https://github.com/WagicProject/wagic into ci_upload_binaries 2013-12-06 00:41:16 +01:00
xawotihs
8100e390b1 I'm starting to understand the stuff, the upload only works with a releaseId... 2013-12-06 00:10:36 +01:00
Tobias Loose
72e6876001 Remove temporary and binary files 2013-12-05 23:57:03 +01:00
Tobias Loose
96aeaffa1b Style and logic error. 2013-12-05 23:33:43 +01:00
xawotihs
74faa35b91 Removed useless local file copy before upload. 2013-12-05 23:27:40 +01:00
Tobias Loose
8bb58ca3b1 Put boilerplate code into easing base class 2013-12-05 23:27:28 +01:00
Tobias Loose
93d1a637b6 Style guide 2013-12-05 23:22:50 +01:00
xawotihs
30e86ffcd8 Update script to handle better variables. 2013-12-05 23:09:06 +01:00
Tobias Loose
cbe6c0c842 Parameterize animations in grid deck view 2013-12-05 23:06:32 +01:00
Tobias Loose
77eb7f2777 Add missing header 2013-12-05 23:06:32 +01:00
Tobias Loose
077ab10c05 Rename Button to ButtonPressed 2013-12-05 23:06:32 +01:00
Tobias Loose
1194463349 Let the deck view base class handle buttons 2013-12-05 23:06:32 +01:00
Tobias Loose
8de50532f2 Put easing code into Easing.h. Add easing to sliding 2013-12-05 23:06:31 +01:00
Tobias Loose
334454655d Add Easing code to make scrolling in grid view more fluid 2013-12-05 23:06:31 +01:00
Tobias Loose
d8d52e185d Add another missing include 2013-12-05 23:06:31 +01:00
Tobias Loose
9f1d225259 Add additional source files to various build systems 2013-12-05 23:06:30 +01:00
Tobias Loose
0c72bfd4c4 Make deck views toggleable 2013-12-05 23:06:30 +01:00
Tobias Loose
55e0366f19 Move griddeckview implementation into source file 2013-12-05 23:06:30 +01:00
Tobias Loose
667b95f2b8 Refactor gamestatedeckviewer and add a grid view suited...
for bigger screens.
2013-12-05 23:06:30 +01:00
Tobias Loose
e90f6fe224 Whitespaces and add button to toggle griv/scrolling view 2013-12-05 23:06:30 +01:00
Tobias Loose
2289fffb8d Do not ftbfs when in release mode (-weror, -wunused-.. combination) 2013-12-05 23:06:30 +01:00
xawotihs
826403a512 Fixed upload shell script 2013-12-05 22:44:02 +01:00
xawotihs
35fec3d9a0 Made upload-binaries executable 2013-12-05 22:05:31 +01:00
xawotihs
e9eb86488e Redirect ant update errors to a file and push correct upload-binaries.sh 2013-12-05 21:43:29 +01:00
xawotihs
ae97abbf96 Activates an automatic pre-release and binary upload from Travis. 2013-12-05 21:21:08 +01:00
Xawotihs
a8391112b0 Merge pull request #576 from ZobyTwo/directories_1
Do not specify the system directory in JGE
2013-12-04 13:07:05 -08:00
Rolzad73
4257592568 Updated output of info about Android APIs 2013-12-04 12:58:22 -05:00
Tobias Loose
657479e0e4 Do not specify the system directory in JGE 2013-12-04 11:58:36 +01:00
Dmitry Panin
9e969881fd Added output of info about Android APIs 2013-12-04 12:04:54 +04:00
Dmitry Panin
2b434a7182 Merge pull request #575 from WagicProject/android_travis_sdk_downgrade
Changed Travis build file to use Android API 10 and Android build tools 18.1.1
2013-12-04 00:02:49 -08:00
Rolz73
d2e41f98c3 Changed Travis build file to use Android API 10 and Android build tools 18.1.1 2013-12-03 02:36:11 -05:00
Xawotihs
318fc98a39 Merge pull request #574 from WagicProject/feature/play-from-grave
Feature/play from grave
2013-12-02 12:34:52 -08:00
Dmitry Panin
b7a4b7f6b9 Fixing Yawgmoth's will 2013-12-02 21:26:55 +04:00
Dmitry Panin
ed03fb744d Added [Yawgmoth's Will] 2013-12-02 13:42:31 +04:00
Dmitry Panin
02be213d1e Test for keyword "CanPlayFromGraveyard"
Also added card [Crucible of Worlds] as example of it.
2013-12-02 04:36:58 +04:00
Dmitry Panin
0d4db9ee54 Fixed bug in alternative cost when playing lands 2013-12-02 04:33:39 +04:00
Dmitry Panin
ae927576c5 Draft of new feature: canplayfromgraveyard
this will allow playing cards from graveyard
examples: tbd
2013-12-02 04:20:04 +04:00
Dmitry Panin
f08ddac77b Fixed formatting 2013-12-02 04:16:25 +04:00
Dmitry Panin
9effa7c975 Slightly changed formatting while investigating src 2013-12-01 01:01:57 +04:00
Dmitry Panin
a70259b5ba Fixed: Assembly-Worker didn't appear as creature type
For artifact creatures the parent type TYPE_ARTIFACT was used
and therefore that creature's subtype wasn't added in full list.
2013-12-01 00:59:16 +04:00
xawotihs
bf0a0a1580 Build the graphics version in release instead of debug. 2013-11-30 19:32:55 +01:00
xawotihs
eb8b22b2d5 Merge branch 'master' of https://github.com/WagicProject/wagic 2013-11-30 12:21:43 +01:00
xawotihs
4095676b6b Fixed memory leak introduced in #555 2013-11-29 22:07:45 +01:00
xawotihs
bedd1e8da8 Merge branch 'valgrind' of https://github.com/ZobyTwo/wagic into ZobyTwo-valgrind 2013-11-29 19:41:46 +01:00
xawotihs
965d4f6d45 Fixes Windows project 2013-11-29 19:31:23 +01:00
Tobias Loose
0db2925e7a Fix initialization orders 2013-11-29 18:44:30 +01:00
Tobias Loose
031f2dbffb Fix Valgrind warnings appearing during the test suit. 2013-11-29 18:21:53 +01:00
Tobias Loose
dbece750f8 Use tabs instead of spaces if the file uses tabs 2013-11-29 13:51:13 +01:00
Tobias Loose
6699902c24 Add TIXML_USE_STL to android builds 2013-11-29 13:34:44 +01:00
Tobias Loose
e8407caa2a Add TIXML_USE_STL compiler flag to psp makefile to make headers compatible 2013-11-29 13:34:35 +01:00
Tobias Loose
69c6745f53 Make getMenuText() return string. 2013-11-29 13:33:33 +01:00
Tobias Loose
6f083389c2 Speedup MTGAllCards::countByType a bit 2013-11-29 11:51:58 +01:00
Tobias Loose
9ee44ca091 Substitute more char arrays with strings 2013-11-29 11:51:22 +01:00
Tobias Loose
3f0dd987f0 Remove bool CardInstance::hasSubtype(const char * _subtype)
There exists bool CardInstance::hasSubtype(const string& _subtype) and the
const char* version converts _subtype into string deeper in the call
hierarchy anyway. So both methods did the same.
2013-11-29 11:43:59 +01:00
Tobias Loose
672b0be7bd Fix a few string bugs add StartsWith for strings 2013-11-29 11:38:49 +01:00
Tobias Loose
9d5a83d588 Replace more strcmp with std::string::compare or std::string::operator==.
This commit also enables TinyXML STL support.
2013-11-28 16:42:29 +01:00
Tobias Loose
5d0d130587 Make MTGGameZone::countByType use string instead of char*
and replace strcmp with std::string operator== calls.
2013-11-28 16:42:29 +01:00
Tobias Loose
c85d857604 Replace constness cast 2013-11-28 16:42:29 +01:00
Tobias Loose
f68568cc1e Replace strcmp with c++ equivalent when comparing std::strings. 2013-11-28 16:42:29 +01:00
Dmitry Panin
89206b3a6b Added testing that QT GUI build is successfull 2013-11-28 16:44:12 +04:00
xawotihs
dc118c64b8 Fixed compilation on Mac 2013-11-27 23:04:46 +01:00
xawotihs
a43854420d Fixed compilation issue on Windows 2013-11-27 20:33:59 +01:00
xawotihs
02a65ecd82 Merge branch 'cleanup_1' of https://github.com/ZobyTwo/wagic into ZobyTwo-cleanup_1 2013-11-26 00:17:48 +01:00
114 changed files with 3402 additions and 1985 deletions

View File

@@ -1,17 +1,28 @@
language: cpp
branches:
except:
- latest-master
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"
- 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
- 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 jq; 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
- $ANDROID list sdk -a
- echo yes | $ANDROID update sdk -a --filter 1,2,4,18 --no-ui --force > log.txt
- sudo pip install pyjavaproperties
script: ./travis-script.sh
env:
global:
secure: "fJgWlCFbde96OSQNGKUmowGX+ERPeqP+n1EOMf1+FJzOU4DdkTLRAlV5+5qnEX9jB/3mWN6iPpmG1qEz/SdDG3KHxJYs4ZU/Lu485O24zZ/+GdYBNsrvhPD9ckPGEMLDa1foEVTDnW0Dlkz3BCFcszjhtXGUJv7v6Pj6LRk1Mg8="
script: "./travis-script.sh"
after_success: ./upload-binaries.sh

View File

@@ -73,7 +73,7 @@
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
@@ -101,7 +101,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
@@ -129,7 +129,7 @@
<Optimization>Full</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>src/zipFS;Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>SDL_CONFIG;WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_HAS_ITERATOR_DEBBUGING=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TIXML_USE_STL; SDL_CONFIG;WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_HAS_ITERATOR_DEBBUGING=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>

View File

@@ -31,6 +31,7 @@ HGE_OBJS = src/hge/hgecolor.o src/hge/hgeparticle.o \
CXXFLAGS = -W -Wall -Werror -Wno-unused
CXXFLAGS += -DTIXML_USE_STL
ifdef DEBUG
CXXFLAGS += -ggdb3

View File

@@ -61,7 +61,7 @@ std::string ToHex(T* pointer)
{ \
std::ostringstream stream; \
stream << inString << std::endl; \
OutputDebugString(stream.str().c_str()); \
OutputDebugStringA(stream.str().c_str()); \
}
#endif // QT_CONFIG
#endif // Win32, Linux

View File

@@ -67,7 +67,7 @@ bool JAnimator::Load(const char* scriptFile)
element = script->ToElement();
printf("---- Loading %s:%s\n", element->Value(), element->Attribute("name"));
const char *type[] =
string type[] =
{
"ANIMATION_TYPE_LOOPING",
"ANIMATION_TYPE_ONCE_AND_STAY",
@@ -78,7 +78,7 @@ bool JAnimator::Load(const char* scriptFile)
const char* aniType = element->Attribute("type");
for (int i=0;i<5;i++)
if (strcmp(type[i], aniType)==0)
if (type[i] == aniType)
{
SetAnimationType(i);
break;
@@ -108,7 +108,7 @@ bool JAnimator::Load(const char* scriptFile)
element = param->ToElement();
if (element != NULL)
{
if (strcmp(element->Value(), "settings")==0)
if (element->ValueStr() == "settings")
{
const char* quadName = element->Attribute("quad");
JQuad* quad = mResource->GetQuad(quadName);

View File

@@ -126,7 +126,7 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
DebugTrace("User path " << userPath);
#elif defined (QT_CONFIG)
QDir sysDir("projects/mtg/bin/Res");
QDir sysDir(RESDIR);
QDir dir(QDir::homePath());
dir.mkdir(USERDIR);
dir.cd(USERDIR);

View File

@@ -65,7 +65,7 @@ void JQuad::SetHotSpot(float x, float y)
//////////////////////////////////////////////////////////////////////////
JTexture::JTexture() : mBuffer(NULL)
JTexture::JTexture() : mWidth(0), mHeight(0), mBuffer(NULL)
{
mTexId = -1;
}
@@ -305,14 +305,12 @@ void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused)))
{
JTexture *tex = new JTexture();
return tex;
}
JTexture* JRenderer::LoadTexture(const char* filename, int mode, int textureFormat)
{
JTexture *tex = new JTexture();
return tex;
}

View File

@@ -75,10 +75,10 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
int count;
while (filePtr < size)
{
while (filePtr < size)
{
filePtr = ReadLine(tmpLine, buffer, filePtr, size);
{
{
if ((tmpLine[0] == '#') || (strlen(tmpLine) < 3))
{
@@ -89,19 +89,19 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
if (count == 4)
{
if (strcmp(s1, "vn") == 0)
if (string("vn") == s1)
normalList.push_back(vert);
else if (strcmp(s1, "vt") == 0)
else if (string("vt") == s1)
texList.push_back(vert);
else if (strcmp(s1, "v") == 0)
else if (string("v") == s1)
vertList.push_back(vert);
}
else if (count == 3)
{
if (strcmp(s1, "vt") == 0)
if (string("vt") == s1)
texList.push_back(vert);
}
}
else if (tmpLine[0] == 'f')
{
@@ -211,7 +211,7 @@ bool JOBJModel::Load(const char *modelName, const char *textureName)
if (textureName != NULL)
mTexture = JRenderer::GetInstance()->LoadTexture(textureName);
return true;
return true;
}

View File

@@ -90,7 +90,7 @@ bool JParticleEffect::Load(const char* filename)
// FIELD_COUNT
// };
const char* lifeValues[] =
const string lifeValues[] =
{
"speed",
"size",
@@ -104,7 +104,7 @@ bool JParticleEffect::Load(const char* filename)
"gravity"
};
const char* typeNames[] =
const string typeNames[] =
{
"POINT",
"AREA",
@@ -113,7 +113,7 @@ bool JParticleEffect::Load(const char* filename)
"CIRCLE"
};
const char* modeNames[] =
const string modeNames[] =
{
"REPEAT",
"ONCE",
@@ -149,32 +149,32 @@ bool JParticleEffect::Load(const char* filename)
{
element = param->ToElement();
if (strcmp(element->Attribute("name"), "settings")==0)
if (string("settings") == element->Attribute("name"))
{
if (strcmp(element->Attribute("blend"), "NORMAL")==0)
if (string("NORMAL") == element->Attribute("blend"))
mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
else if (strcmp(element->Attribute("blend"), "ADDITIVE")==0)
else if (string("ADDITIVE") == element->Attribute("blend"))
mParticleEmitters[mEmitterCount]->SetBlending(BLEND_SRC_ALPHA, BLEND_ONE);
for (unsigned int i=0;i<sizeof(modeNames)/sizeof(char*);i++)
{
if (strcmp(element->Attribute("mode"), modeNames[i])==0)
if (modeNames[i] == element->Attribute("mode"))
{
mParticleEmitters[mEmitterCount]->mEmitterMode = i;
#if defined (_DEBUG)
printf("emitter mode:%s\n", modeNames[i]);
printf("emitter mode:%s\n", modeNames[i].c_str());
#endif
break;
}
}
for (unsigned i=0;i<sizeof(typeNames)/sizeof(char*);i++)
{
if (strcmp(element->Attribute("type"), typeNames[i])==0)
if (typeNames[i] == element->Attribute("type"))
{
mParticleEmitters[mEmitterCount]->mType = i;
#if defined (_DEBUG)
printf("emitter type:%s\n", typeNames[i]);
printf("emitter type:%s\n", typeNames[i].c_str());
#endif
break;
}
@@ -213,7 +213,7 @@ bool JParticleEffect::Load(const char* filename)
}
}
else if (strcmp(element->Attribute("name"), "quantity")==0)
else if (string("quantity") == element->Attribute("name"))
{
for (key = param->FirstChild(); key; key = key->NextSibling())
{
@@ -227,7 +227,7 @@ bool JParticleEffect::Load(const char* filename)
}
}
else if (strcmp(element->Attribute("name"), "lifex")==0)
else if (string("lifex") == element->Attribute("name"))
{
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -236,7 +236,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mLifeMax= value;
}
}
else if (strcmp(element->Attribute("name"), "anglex")==0)
else if (string("anglex") == element->Attribute("name"))
{
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -245,7 +245,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mAngleMax= value*DEG2RAD;
}
}
else if (strcmp(element->Attribute("name"), "speedx")==0)
else if (string("speedx") == element->Attribute("name"))
{
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -254,7 +254,7 @@ bool JParticleEffect::Load(const char* filename)
mParticleEmitters[mEmitterCount]->mSpeedMax= value;
}
}
else if (strcmp(element->Attribute("name"), "sizex")==0)
else if (string("sizex") == element->Attribute("name"))
{
if (element->QueryFloatAttribute("base", &baseValue) == TIXML_SUCCESS &&
element->QueryFloatAttribute("max", &value) == TIXML_SUCCESS)
@@ -267,7 +267,7 @@ bool JParticleEffect::Load(const char* filename)
{
for (int i=0;i<FIELD_COUNT;i++)
{
if (strcmp(element->Attribute("name"), lifeValues[i])==0)
if (lifeValues[i] == element->Attribute("name"))
{
for (key = param->FirstChild(); key; key = key->NextSibling())
{

View File

@@ -119,11 +119,11 @@ bool JResourceManager::LoadResource(const string& resourceName)
element = node->ToElement();
if (element != NULL)
{
if (strcmp(element->Value(), "texture")==0)
if (element->ValueStr() == "texture")
{
CreateTexture(element->Attribute("name"));
}
else if (strcmp(element->Value(), "quad")==0)
else if (element->ValueStr() == "quad")
{
string quadName = element->Attribute("name");
string textureName = element->Attribute("texture");
@@ -170,7 +170,7 @@ bool JResourceManager::LoadResource(const string& resourceName)
GetQuad(id)->SetHotSpot(hotspotX, hotspotY);
}
}
else if (strcmp(element->Value(), "font")==0)
else if (element->ValueStr() == "font")
{
}

View File

@@ -96,9 +96,8 @@ int main(int argc, char* argv[])
options.reloadProfile();
TestSuite testSuite("test/_tests.txt");
result = testSuite.run();
int totalTests = testSuite.nbTests + testSuite.nbAITests;
delete wagicCore;
DebugTrace("TestSuite done: failed test: " << result << " out of " << totalTests << " total");
DebugTrace("TestSuite done: failed test: " << result << " out of " << testSuite.nbTests + testSuite.nbAITests << " total");
#ifdef CAPTURE_STDERR
OutputCapturer::debugAndClear();
#endif

View File

@@ -69,7 +69,7 @@ int main(int argc, char* argv[])
#endif //QT_WIDGET
if(argc >= 2 && strcmp(argv[1], "testsuite")==0)
if(argc >= 2 && string(argv[1]) == "testsuite")
{
int result = 0;
result += WagicCore::runTestSuite();

View File

@@ -166,12 +166,11 @@ void DestroyGame(void)
[menuKeyRecognizer requireGestureRecognizerToFail: selectKeyRecognizer];
[self addGestureRecognizer:menuKeyRecognizer];
// initialize the scaling factor
lastScale = 1.f;
/*
UIPinchGestureRecognizer *pinchZoomRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchZoom:)];
[self addGestureRecognizer:pinchZoomRecognizer];
[pinchZoomRecognizer release];
*/
/*
Create a single tap recognizer to select the nearest object.
@@ -392,6 +391,8 @@ void DestroyGame(void)
}
- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
@@ -424,21 +425,6 @@ void DestroyGame(void)
}
#pragma mark Gesture Recognizer callbacks
- (void)handlePinchZoom: (UIPinchGestureRecognizer *) pinchGesture {
[[[pinchGesture view] layer] removeAllAnimations];
CGFloat currentScaleFactor = [pinchGesture scale];
if (pinchGesture.state == UIGestureRecognizerStateEnded) {
if (lastScale < 1.3f) {
lastScale *= currentScaleFactor;
}
else {
lastScale = 1;
[self displayGameMenu];
}
pinchGesture.scale = 1.f;
}
}
- (void)handlePanMotion: (UIPanGestureRecognizer *) panGesture
{

View File

@@ -47,6 +47,7 @@
- (void)viewDidLoad {
NSLog(@"EAGL ViewController - view Did Load");
[super viewDidLoad];
}
@@ -55,6 +56,7 @@
[self.view resumeGame];
}
- (void)viewWillDisappear:(BOOL)animated
{
[self.view pauseGame];
@@ -75,10 +77,6 @@
[self.view endGame];
}
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
- (void)viewDidAppear:(BOOL)animated {
NSLog(@"EAGL ViewController - view Did Appear");

View File

@@ -7,7 +7,6 @@
#include "JFileSystem.h"
#include "JRenderer.h"
#include "JGameLauncher.h"
#include "UIScreen+Util.h"
#define ACTUAL_SCREEN_WIDTH (SCREEN_WIDTH)
#define ACTUAL_SCREEN_HEIGHT (SCREEN_HEIGHT)
@@ -62,7 +61,7 @@ bool checkFramebufferStatus();
// for retina devices. because of the 568 px, the ratio between height-width skews the
// frame a bit
if ( [UIScreen isRetinaDisplay]) {
if ( backingHeight == 568 || backingWidth == 568) {
viewPort.left = 0;
viewPort.top = -((backingWidth/ACTUAL_RATIO)-backingHeight)/2 + 22; // account for status bar
viewPort.right = backingWidth;

View File

@@ -343,7 +343,7 @@ void JQuad::SetHotSpot(float x, float y)
//////////////////////////////////////////////////////////////////////////
JTexture::JTexture() : mBuffer(NULL)
JTexture::JTexture() : mWidth(0), mHeight(0), mBuffer(NULL)
{
mTexId = -1;
}
@@ -2486,7 +2486,7 @@ void JRenderer::Enable2D()
#if (defined GL_VERSION_ES_CM_1_1) || (defined GL_OES_VERSION_1_1)
glOrthof(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f, -1.0f, 1.0f);
#else
gluOrtho2D(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f);
glOrtho(0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f, -1.0f, 1.0f);
#endif
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix

View File

@@ -335,7 +335,7 @@ void WagicCore::resizeGL(int width, int height)
#if (defined GL_VERSION_ES_CM_1_1 || defined GL_OES_VERSION_1_1)
glOrthof(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f, -1.0f, 1.0f);
#else
gluOrtho2D(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f);
glOrtho(0.0f, (float) (m_viewPort.right()-m_viewPort.left())-1.0f, 0.0f, (float) (m_viewPort.bottom()-m_viewPort.top())-1.0f, -1.0f, 1.0f);
#endif
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix

View File

@@ -14,7 +14,7 @@ PNG_PATH := $(JGE_PATH)/Dependencies/libpng
DEBUG ?= DEBUG
LOCAL_CFLAGS += -DLINUX -DANDROID -DSDL_CONFIG -D_$(DEBUG)
LOCAL_CFLAGS += -D_STLP_USE_SIMPLE_NODE_ALLOC
LOCAL_CFLAGS += -D_STLP_USE_SIMPLE_NODE_ALLOC -DTIXML_USE_STL
LOCAL_CFLAGS += -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS
LOCAL_STATIC_LIBRARIES := libpng libjpeg
LOCAL_SHARED_LIBRARIES := SDL
@@ -136,6 +136,9 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
$(MTG_PATH)/src/WFont.cpp \
$(MTG_PATH)/src/WGui.cpp \
$(MTG_PATH)/src/WResourceManager.cpp \
$(MTG_PATH)/src/DeckView.cpp \
$(MTG_PATH)/src/CarouselDeckView.cpp \
$(MTG_PATH)/src/GridDeckView.cpp \
$(JGE_PATH)/src/SDLmain.cpp \
$(JGE_PATH)/src/Encoding.cpp \
$(JGE_PATH)/src/JAnimator.cpp \

View File

@@ -27,7 +27,7 @@ OBJS = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.o\
objs/ThisDescriptor.o objs/Token.o objs/Translate.o objs/TranslateKeys.o\
objs/Trash.o objs/utils.o objs/WEvent.o objs/WResourceManager.o\
objs/WCachedResource.o objs/WDataSrc.o objs/WGui.o objs/WFilter.o objs/Tasks.o\
objs/WFont.o
objs/WFont.o objs/CarouselDeckView.o objs/GridDeckView.o objs/DeckView.o
DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS))
RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache)
@@ -73,7 +73,7 @@ PSP_EBOOT_UNKPNG = pic0.png
PSP_EBOOT_PIC1 = pic1.png
INCDIR = ../../JGE/include ../../JGE/src/zipFS ../../JGE/include/psp ../../JGE/include/psp/freetype2 ../../JGE/src ../../projects/mtg/include ../../Boost
LIBDIR = ../../JGE/lib/psp
CFLAGS = -O2 -G0 -DPSPFW3XX -DDEVHOOK -DUSE_PRECOMPILED_HEADERS=1 -DPSP
CFLAGS = -O2 -G0 -DPSPFW3XX -DDEVHOOK -DUSE_PRECOMPILED_HEADERS=1 -DPSP -DTIXML_USE_STL
else
OBJS += objs/TestSuiteAI.o
INCDIR = -I../../JGE/include -I../../JGE/src -I/usr/X11/include -I../../projects/mtg/include -I../../Boost -I../../JGE/src/zipFS

View File

@@ -7,10 +7,13 @@ from optparse import OptionParser
def createResZipFile(filename):
utilities = ZipUtilities()
rename = False
if not os.path.isfile('settings/options.txt'):
os.rename('settings/options.orig.txt', 'settings/options.txt')
remame = True
if not os.path.isfile('player/options.txt'):
os.rename('player/options.orig.txt', 'player/options.txt')
rename = True
zip_file = zipfile.ZipFile(filename, 'w', zipfile.ZIP_STORED)
utilities.addFolderToZip(zip_file, 'themes')
@@ -25,6 +28,10 @@ def createResZipFile(filename):
utilities.addFolderToZip(zip_file, 'campaigns')
utilities.addFolderToZip(zip_file, 'ai')
zip_file.close()
if rename:
os.rename('settings/options.txt', 'settings/options.orig.txt')
os.rename('player/options.txt', 'player/options.orig.txt')
def getFilename():
p = Properties();

View File

@@ -16,6 +16,7 @@ auto=flashbackrule
auto=retracerule
auto=suspendrule
auto=morphrule
auto=playfromgraveyardrule
auto=attackrule
auto=blockrule
auto=combattriggerrule

View File

@@ -1513,3 +1513,8 @@ primitive=Zephyr Net
id=142357
rarity=C
[/card]
[card]
primitive=Avatar Token
id=-140233
rarity=T
[/card]

View File

@@ -1248,3 +1248,8 @@ primitive=Zombie Goliath
id=190545
rarity=C
[/card]
[card]
primitive=Avatar Token
id=-191239
rarity=T
[/card]

View File

@@ -1257,4 +1257,9 @@ rarity=U
primitive=Yavimaya Wurm
id=205221
rarity=C
[/card]
[/card]
[card]
primitive=Avatar Token
id=-205957
rarity=T
[/card]

View File

@@ -18104,6 +18104,13 @@ mana={3}{R}
type=Enchantment
[/card]
[card]
name=Crucible of Worlds
auto=lord(land|mygraveyard) CanPlayFromGraveyard
text=You may play land cards from your graveyard.
mana={3}
type=Artifact
[/card]
[card]
name=Crude Rampart
abilities=defender
facedown={3}
@@ -103468,6 +103475,15 @@ mana={1}{B}
type=Enchantment
[/card]
[card]
name=Yawgmoth's Will
auto=lord(*|mygraveyard) canPlayFromGraveyard
auto=emblem transforms((,newability[@movedTo(*|mygraveyard):all(trigger[to]) moveTo(exile)])) ueot
auto=moveTo(exile)
text=Until end of turn, you may play cards from your graveyard. -- If a card would be put into your graveyard from anywhere this turn, exile that card instead.
mana={2}{B}
type=Sorcery
[/card]
[card]
name=Yawning Fissure
auto=ability$!name(sacrifice land) notatarget(land|mybattlefield) sacrifice!$ opponent
text=Each opponent sacrifices a land.

View File

@@ -3187,19 +3187,6 @@ mana={2}
type=Artifact
[/card]
[card]
name=Crucible of Worlds
auto={0}:may moveTo(myBattlefield) target(land|mygraveyard) limit:1 myTurnOnly
# Above line does not work: "May moveto" from graveyards does
# not work due to interface issues. The "limit:1" doesn't work
# here either. Even if both worked, then the card would allow
# you to play lands *in addition* to the 1 land you can play per
# turn. Instead it should just give you the option to play this
# 1 land from your hand or your graveyard.
text=You may play land cards from your graveyard.
mana={3}
type=Artifact
[/card]
[card]
name=Cruel Deceiver
text={1}: Look at the top card of your library. -- {2}: Reveal the top card of your library. If it's a land card, Cruel Deceiver gains "Whenever Cruel Deceiver deals damage to a creature, destroy that creature" until end of turn. Activate this ability only once each turn.
mana={1}{B}

View File

@@ -249,6 +249,7 @@ curiosity2_i217.txt
crimson_kobolds.txt
crosis_s_catacombs_1.txt
crosis_s_catacombs_2.txt
crucible_of_worlds.txt
crumble.txt
crystal_rod_i172.txt
cursed_land1_i188.txt

View File

@@ -0,0 +1,26 @@
# Testing crucible of worlds (keyword: CANPLAYFROMGRAVEYARD)
# name=Crucible of Worlds
# text=You may play land cards from your graveyard.
[INIT]
FIRSTMAIN
[PLAYER1]
hand:island,plains
inplay:crucible of worlds
graveyard:forest,mountain
[PLAYER2]
[DO]
forest
# all next lands shouldn't be played
island
mountain
plains
[ASSERT]
FIRSTMAIN
[PLAYER1]
inplay:crucible of worlds,forest
hand:island,plains
graveyard:mountain
[PLAYER2]
[END]

View File

@@ -2,6 +2,7 @@
<!-- build.properties should contain the values for major, minor and point -->
<property file="build.properties" />
<property file="build.number.properties" />
<property environment="env"/>
<path id="groovy.class.path" >
<fileset dir="${groovy.dir}" />
@@ -76,15 +77,16 @@ Author: Michael Nguyen
#define WAGIC_VERSION_MAJOR ${build.major}
#define WAGIC_VERSION_MEDIUM ${build.minor}
#define WAGIC_VERSION_MINOR ${build.point}
#define WAGIC_VERSION_REVISION ${env.TRAVIS_BUILD_NUMBER}
#define VERSION_DOT(a, b, c) a ##.## b ##.## c
#define VERSION_DOT(a, b, c, d) a ##.## b ##.## c ##.## d
#define VERSION_WITHOUT_DOT(a, b, c) a ## b ## c
#define VERSION_GAME(a, b, c) VERSION_DOT(a, b, c)
#define VERSION_GAME(a, b, c, d) VERSION_DOT(a, b, c, d)
#define VERSION_FILE(a, b, c) VERSION_WITHOUT_DOT(a, b, c)
#define VERSION_TOSTRING(a) #a
#define VERSION_STRINGIFY(a) VERSION_TOSTRING(a)
#define WAGIC_VERSION VERSION_GAME(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
#define WAGIC_VERSION VERSION_GAME(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR, WAGIC_VERSION_REVISION)
#define WAGIC_RESOURCE_VERSION VERSION_FILE(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR)
#define WAGIC_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION)
#define WAGIC_CORE_VERSION_STRING "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION)

View File

@@ -1,14 +0,0 @@
//
// UIScreen+Util.h
// wagic
//
// Created by Michael Nguyen on 11/27/13.
//
//
#import <UIKit/UIKit.h>
@interface UIScreen (Util)
+(BOOL)isRetinaDisplay;
@end

View File

@@ -1,23 +0,0 @@
//
// UIScreen+Util.m
// wagic
//
// Created by Michael Nguyen on 11/27/13.
//
//
#include "UIScreen+Util.h"
static BOOL isRetinaScreen = NO;
static BOOL didRetinaCheck = NO;
@implementation UIScreen (Util)
+ (BOOL)isRetinaDisplay
{
if (!didRetinaCheck) {
isRetinaScreen = ([[self mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] &&
([self mainScreen].scale == 2.0));
didRetinaCheck = YES;
}
return isRetinaScreen;
}
@end

View File

@@ -72,7 +72,7 @@ public:
{
return 0;
}
virtual const char * getMenuText()
virtual const string getMenuText()
{
return "Ability";
}

View File

@@ -1081,7 +1081,7 @@ public:
ManaCost * cost = NULL);
int resolve();
const char* getMenuText();
const string getMenuText();
AACounter * clone() const;
};
@@ -1100,7 +1100,7 @@ public:
bool all,ManaCost * cost = NULL);
int resolve();
const char* getMenuText();
const string getMenuText();
AARemoveAllCounter * clone() const;
};
@@ -1110,7 +1110,7 @@ class AAResetDamage: public ActivatedAbility
public:
AAResetDamage(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, ManaCost * cost = NULL);
int resolve();
const char* getMenuText();
const string getMenuText();
AAResetDamage * clone() const;
};
@@ -1120,7 +1120,7 @@ public:
string named;
AAFakeAbility(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string _newName, ManaCost * cost = NULL);
int resolve();
const char* getMenuText();
const string getMenuText();
AAFakeAbility * clone() const;
};
@@ -1131,7 +1131,7 @@ public:
AAFizzler(GameObserver* observer, int _id, MTGCardInstance * card, Spell * _target, ManaCost * _cost = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
AAFizzler* clone() const;
};
@@ -1160,7 +1160,7 @@ public:
string Cond;
IfThenAbility(GameObserver* observer, int _id,MTGAbility * delayedAbility = NULL,MTGAbility * delayedElseAbility = NULL, MTGCardInstance * _source=NULL, Targetable * target = NULL, int type = 1,string Cond = "");
int resolve();
const char * getMenuText();
const string getMenuText();
IfThenAbility * clone() const;
~IfThenAbility();
};
@@ -1179,7 +1179,7 @@ public:
void Update(float dt);
const char * getMenuText();
const string getMenuText();
int testDestroy();
int isReactingToTargetClick(Targetable * card);
@@ -1209,7 +1209,7 @@ public:
bool CheckUserInput(JButton key);
void Update(float dt);
int resolve();
const char * getMenuText();
const string getMenuText();
int testDestroy();
int isReactingToTargetClick(Targetable * card);
int reactToTargetClick(Targetable * object);
@@ -1225,7 +1225,7 @@ class AAProliferate: public ActivatedAbility
public:
AAProliferate(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,ManaCost * cost = NULL);
int resolve();
const char* getMenuText();
const string getMenuText();
AAProliferate * clone() const;
~AAProliferate();
};
@@ -1243,7 +1243,7 @@ public:
int resolve();
int addToGame();
int destroy();
const char * getMenuText();
const string getMenuText();
MultiAbility * clone() const;
~MultiAbility();
};
@@ -1258,8 +1258,9 @@ public:
GenericActivatedAbility(GameObserver* observer, string newName,string castRestriction,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "",
int restrictions = 0, MTGGameZone * dest = NULL);
GenericActivatedAbility(const GenericActivatedAbility& other);
int resolve();
const char * getMenuText();
const string getMenuText();
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
void Update(float dt);
int testDestroy();
@@ -1274,7 +1275,7 @@ class AALibraryBottom: public ActivatedAbility
public:
AALibraryBottom(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
AALibraryBottom * clone() const;
};
@@ -1284,7 +1285,7 @@ class AACopier: public ActivatedAbility
public:
AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
AACopier * clone() const;
};
//imprint
@@ -1293,7 +1294,7 @@ class AAPhaseOut: public ActivatedAbility
public:
AAPhaseOut(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
AAPhaseOut * clone() const;
};
//cloning...this makes a token thats a copy of the target.
@@ -1310,7 +1311,7 @@ public:
AACloner(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL, int who = 0,
string abilitiesStringList = "",string typeslist = "");
int resolve();
const char * getMenuText();
const string getMenuText();
virtual ostream& toString(ostream& out) const;
AACloner * clone() const;
~AACloner();
@@ -1326,7 +1327,7 @@ public:
AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL);
MTGGameZone * destinationZone(Targetable * target = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
const char * getMenuText(TargetChooser * fromTc);
AAMover * clone() const;
~AAMover();
@@ -1342,7 +1343,7 @@ public:
AARandomMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string tcs, string from, string to);
MTGGameZone * destinationZone(Targetable * target = NULL,string zone = "");
int resolve();
const char * getMenuText();
const string getMenuText();
AARandomMover * clone() const;
~AARandomMover();
};
@@ -1356,7 +1357,7 @@ public:
string menu;
AABuryCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve();
const char * getMenuText();
const string getMenuText();
AABuryCard * clone() const;
~AABuryCard();
};
@@ -1367,7 +1368,7 @@ public:
MTGAbility * andAbility;
AADestroyCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve();
const char * getMenuText();
const string getMenuText();
AADestroyCard * clone() const;
~AADestroyCard();
};
@@ -1378,7 +1379,7 @@ public:
MTGAbility * andAbility;
AASacrificeCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve();
const char * getMenuText();
const string getMenuText();
AASacrificeCard * clone() const;
~AASacrificeCard();
};
@@ -1389,7 +1390,7 @@ public:
MTGAbility * andAbility;
AADiscardCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target);
int resolve();
const char * getMenuText();
const string getMenuText();
AADiscardCard * clone() const;
~AADiscardCard();
};
@@ -1409,7 +1410,7 @@ public:
string tcString;
GenericTargetAbility(GameObserver* observer, string newName, string castRestriction, int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", int restrictions = 0, MTGGameZone * dest = NULL,string tcString ="");
const char * getMenuText();
const string getMenuText();
~GenericTargetAbility();
GenericTargetAbility * clone() const;
int resolve();
@@ -1447,7 +1448,7 @@ public:
return 1;
}
const char * getMenuText()
const string getMenuText()
{
return "Ninjutsu";
}
@@ -1479,7 +1480,7 @@ public:
return 1;
}
const char * getMenuText()
const string getMenuText()
{
return "Remove From Combat";
}
@@ -1501,7 +1502,7 @@ public:
AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost,string nbcardsStr, int who =
TargetChooser::UNSET,bool noReplace = false);
int resolve();
const char * getMenuText();
const string getMenuText();
AADrawer * clone() const;
int getNumCards();
};
@@ -1521,7 +1522,7 @@ public:
ACastRestriction(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET);
int addToGame();
int destroy();
const char * getMenuText();
const string getMenuText();
ACastRestriction * clone() const;
~ACastRestriction();
@@ -1536,7 +1537,7 @@ public:
AInstantCastRestrictionUEOT(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, TargetChooser * _restrictionsScope, WParsedInt * _value, bool _modifyExisting, int _zoneId, int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AInstantCastRestrictionUEOT * clone() const;
~AInstantCastRestrictionUEOT();
};
@@ -1549,7 +1550,7 @@ public:
AALifer(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string life_s, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AALifer * clone() const;
int getLife();
@@ -1562,7 +1563,7 @@ public:
AAWinGame(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AAWinGame * clone() const;
};
@@ -1603,7 +1604,7 @@ public:
return 1;
}
const char * getMenuText()
const string getMenuText()
{
return Constants::MTGBasicAbilities[ability];
}
@@ -1645,7 +1646,7 @@ public:
return InstantAbility::addToGame();
}
const char * getMenuText()
const string getMenuText()
{
return Constants::MTGBasicAbilities[ability];
}
@@ -1706,7 +1707,7 @@ public:
return ActivatedAbility::addToGame();
}
const char * getMenuText()
const string getMenuText()
{
return ability->getMenuText();
}
@@ -1862,7 +1863,7 @@ public:
return 1;
}
const char * getMenuText()
const string getMenuText()
{
sprintf(menuText,"Protection from %s",tcstr.c_str());
return menuText;
@@ -2054,7 +2055,7 @@ public:
((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue());
return 1;
}
const char * getMenuText()
const string getMenuText()
{
if(PT.size())
{
@@ -2147,7 +2148,7 @@ public:
return 1;
}
const char * getMenuText()
const string getMenuText()
{
return ability->getMenuText();
}
@@ -2189,7 +2190,7 @@ public:
return toAdd->addToGame();
}
const char * getMenuText()
const string getMenuText()
{
return ability->getMenuText();
}
@@ -2287,7 +2288,7 @@ public:
return 1;
}
const char * getMenuText()
const string getMenuText()
{
return "Regenerate";
}
@@ -2494,7 +2495,7 @@ public:
SAFE_DELETE(ability);
}
const char * getMenuText()
const string getMenuText()
{
if(ability)
{
@@ -2523,13 +2524,13 @@ public:
ALord(GameObserver* observer, int _id, MTGCardInstance * card, TargetChooser * _tc, int _includeSelf, MTGAbility * a) :
ListMaintainerAbility(observer, _id, card), NestedAbility(a)
{
tc = _tc;
tc->targetter = NULL;
includeSelf = _includeSelf;
if(ability->aType == MTGAbility::STANDARD_PREVENT)
aType = MTGAbility::STANDARD_PREVENT;
}
{
tc = _tc;
tc->targetter = NULL;
includeSelf = _includeSelf;
if(ability->aType == MTGAbility::STANDARD_PREVENT)
aType = MTGAbility::STANDARD_PREVENT;
}
//returns true if it is me who created ability a attached to Damageable d
bool isParentOf(Damageable * d, MTGAbility * a)
@@ -2607,7 +2608,8 @@ public:
int removed(MTGCardInstance * card)
{
if (abilities.find(card) != abilities.end() && !(forceDestroy == -1 && forcedAlive == 1))//only embelms have forcedestroy = -1 and forcedalive = 1
if (abilities.find(card) != abilities.end()
&& !(forceDestroy == -1 && forcedAlive == 1)) //only embelms have forcedestroy = -1 and forcedalive = 1
{
game->removeObserver(abilities[card]);
abilities.erase(card);
@@ -2620,7 +2622,7 @@ public:
SAFE_DELETE(ability);
}
const char * getMenuText()
const string getMenuText()
{
//Special case for move
if (AAMover * move = dynamic_cast<AAMover *>(ability))
@@ -2806,7 +2808,7 @@ public:
int equip(MTGCardInstance * equipped);
int resolve();
const char * getMenuText();
const string getMenuText();
int testDestroy();
int destroy();
@@ -3034,7 +3036,7 @@ public:
card->setAttacker(1);
}
const char * getMenuText()
const string getMenuText()
{
sprintf(menuText, "Create %s", name.c_str());
return menuText;
@@ -3135,7 +3137,7 @@ public:
}
}
const char * getMenuText()
const string getMenuText()
{
if(name.size())
return name.c_str();
@@ -3308,7 +3310,7 @@ public:
return 0;
}
const char * getMenuText()
const string getMenuText()
{
return ability->getMenuText();
}
@@ -3520,7 +3522,7 @@ public:
}
}
const char * getMenuText()
const string getMenuText()
{
return ability->getMenuText();
}
@@ -3543,7 +3545,7 @@ public:
AASetHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int hand, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AASetHand * clone() const;
};
@@ -3557,7 +3559,7 @@ public:
AALifeSet(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, WParsedInt * life, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AALifeSet * clone() const;
~AALifeSet();
@@ -3574,7 +3576,7 @@ public:
AADamager(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string d, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
int getDamage();
AADamager * clone() const;
@@ -3588,7 +3590,7 @@ public:
AADamagePrevent(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int preventing, ManaCost * _cost = NULL, int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AADamagePrevent * clone() const;
~AADamagePrevent();
};
@@ -3602,7 +3604,7 @@ public:
AAAlterPoison(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int poison, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AAAlterPoison * clone() const;
~AAAlterPoison();
};
@@ -3630,7 +3632,7 @@ class AATapper: public ActivatedAbility
public:
AATapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
AATapper * clone() const;
};
@@ -3640,7 +3642,7 @@ class AAUntapper: public ActivatedAbility
public:
AAUntapper(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
AAUntapper * clone() const;
};
@@ -3661,7 +3663,7 @@ class AAFrozen: public ActivatedAbility
public:
AAFrozen(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
AAFrozen * clone() const;
};
/* ghetto new target*/
@@ -3671,7 +3673,7 @@ public:
bool retarget;
AANewTarget(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,bool retarget = false, ManaCost * _cost = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
AANewTarget * clone() const;
};
/* morph*/
@@ -3682,7 +3684,7 @@ public:
AAMorph(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost = NULL);
int resolve();
int testDestroy();
const char * getMenuText();
const string getMenuText();
AAMorph * clone() const;
};
/* flip*/
@@ -3694,7 +3696,7 @@ public:
AAFlip(GameObserver* observer, int id, MTGCardInstance * card, MTGCardInstance * _target,string flipStats);
int resolve();
int testDestroy();
const char * getMenuText();
const string getMenuText();
AAFlip * clone() const;
};
/* dynamic ability build*/
@@ -3759,7 +3761,7 @@ string menu;
int resolve();
int activateMainAbility(MTGAbility * toActivate,MTGCardInstance * source , Damageable * target);
int activateStored();
const char * getMenuText();
const string getMenuText();
AADynamic * clone() const;
~AADynamic();
};
@@ -3812,7 +3814,7 @@ public:
return 1;
}
const char * getMenuText()
const string getMenuText()
{
return "Swap power and toughness";
}
@@ -3828,7 +3830,7 @@ public:
AAExchangeLife(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AAExchangeLife * clone() const;
};
@@ -4064,7 +4066,7 @@ public:
int reapplyCountersBonus(MTGCardInstance * rtarget= NULL,bool powerapplied=false,bool toughnessapplied=false);
int testDestroy();
int destroy();
const char * getMenuText();
const string getMenuText();
ATransformer * clone() const;
~ATransformer();
};
@@ -4087,7 +4089,7 @@ public:
ATransformerInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, string types = "", string abilities = "",string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false,vector<string>newAbilitiesList = vector<string>(),bool newAbilityFound = false,bool aForever = false, bool UYNT = false,string menutext = "");
int resolve();
const char * getMenuText();
const string getMenuText();
ATransformerInstant * clone() const;
~ATransformerInstant();
};
@@ -4103,7 +4105,7 @@ public:
WParsedPT * newWppt;
PTInstant(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, WParsedPT * wppt,string s = "",bool nonstatic = false);
int resolve();
const char * getMenuText();
const string getMenuText();
PTInstant * clone() const;
~PTInstant();
};
@@ -4162,7 +4164,7 @@ public:
return 1;
}
const char * getMenuText()
const string getMenuText()
{
return "Exalted";
}
@@ -4180,7 +4182,7 @@ public:
ASwapPT * ability;
ASwapPTUEOT(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target);
int resolve();
const char * getMenuText();
const string getMenuText();
ASwapPTUEOT * clone() const;
~ASwapPTUEOT();
};
@@ -4257,7 +4259,7 @@ public:
APreventDamageTypesUEOT(GameObserver* observer, int id, MTGCardInstance * source, string to, string from, int type = 0);
int resolve();
int destroy();
const char * getMenuText();
const string getMenuText();
APreventDamageTypesUEOT * clone() const;
~APreventDamageTypesUEOT();
};
@@ -4274,7 +4276,7 @@ public:
AVanishing(GameObserver* observer, int _id, MTGCardInstance * card, ManaCost * _cost, int restrictions = 0,int amount = 0,string counterName = "");
void Update(float dt);
int resolve();
const char * getMenuText();
const string getMenuText();
AVanishing * clone() const;
~AVanishing();
};
@@ -4296,7 +4298,7 @@ public:
void Update(float dt);
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
virtual ostream& toString(ostream& out) const;
AUpkeep * clone() const;
~AUpkeep();
@@ -4322,7 +4324,7 @@ public:
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = true,bool opponentturn = true,bool once = false);
void Update(float dt);
int resolve();
const char * getMenuText();
const string getMenuText();
APhaseAction * clone() const;
~APhaseAction();
};
@@ -4336,7 +4338,7 @@ public:
APhaseActionGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * target, string sAbility, int restrictions = 0, int _phase =
MTG_PHASE_UPKEEP,bool forcedestroy = false,bool next = true,bool myturn = false,bool opponentturn = false,bool once = false);
int resolve();
const char * getMenuText();
const string getMenuText();
APhaseActionGeneric * clone() const;
~APhaseActionGeneric();
@@ -4356,7 +4358,7 @@ public:
void Update(float dt);
void resolveBlink();
int resolve();
const char * getMenuText();
const string getMenuText();
ABlink * clone() const;
~ABlink();
private:
@@ -4374,7 +4376,7 @@ public:
MTGAbility * stored;
ABlinkGeneric(GameObserver* observer, int _id, MTGCardInstance * card, MTGCardInstance * _target,bool blinkueot=false,bool blinkForSource = false,bool blinkhand = false,MTGAbility * stored = NULL);
int resolve();
const char * getMenuText();
const string getMenuText();
ABlinkGeneric * clone() const;
~ABlinkGeneric();
@@ -5280,7 +5282,7 @@ public:
return 1;
}
const char * getMenuText()
const string getMenuText()
{
return "phase alter";
}
@@ -5299,7 +5301,7 @@ public:
AADepleter(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AADepleter * clone() const;
};
@@ -5312,7 +5314,7 @@ public:
AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbTurnStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AAModTurn * clone() const;
};
@@ -5323,7 +5325,7 @@ public:
AAShuffle(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, ManaCost * _cost = NULL, int who =
TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AAShuffle * clone() const;
};
@@ -5336,7 +5338,7 @@ public:
AARemoveMana(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target, string ManaDesc, int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AARemoveMana * clone() const;
~AARemoveMana();
@@ -5351,7 +5353,7 @@ public:
AARandomDiscarder(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost = NULL,
int who = TargetChooser::UNSET);
int resolve();
const char * getMenuText();
const string getMenuText();
AARandomDiscarder * clone() const;
};
@@ -5523,7 +5525,7 @@ public:
int testDestroy(){return 0;};
void Update(float dt);
const char * getMenuText();
const string getMenuText();
int isReactingToTargetClick(Targetable * card);
int reactToTargetClick(Targetable * object);
MTGCardInstance * makeCard();
@@ -5640,7 +5642,7 @@ public:
MTGAbility * abilityAltered;
AASetColorChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _color = 0 ,string toAdd = "");
int resolve();
const char* getMenuText();
const string getMenuText();
AASetColorChosen * clone() const;
~AASetColorChosen();
};
@@ -5653,7 +5655,7 @@ public:
MTGAbility * abilityAltered;
AASetTypeChosen(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int _type = 0,string menu = "error" ,string toAdd = "");
int resolve();
const char* getMenuText();
const string getMenuText();
AASetTypeChosen * clone() const;
~AASetTypeChosen();
};
@@ -5667,7 +5669,7 @@ public:
bool ANonWall;
GenericChooseTypeColor(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "",bool chooseColor = false,bool nonwall = false, ManaCost * cost = NULL);
int resolve();
const char* getMenuText();
const string getMenuText();
GenericChooseTypeColor * clone() const;
~GenericChooseTypeColor();
@@ -5684,7 +5686,7 @@ public:
MTGAbility * abilityAltered;
AASetCoin(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target, int side = -1,string toAdd = "");
int resolve();
const char* getMenuText();
const string getMenuText();
AASetCoin * clone() const;
~AASetCoin();
};
@@ -5695,7 +5697,7 @@ public:
AASetCoin * setCoin;
GenericFlipACoin(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target, string toAdd = "", ManaCost * cost = NULL);
int resolve();
const char* getMenuText();
const string getMenuText();
GenericFlipACoin * clone() const;
~GenericFlipACoin();
@@ -5714,7 +5716,7 @@ public:
GenericPaidAbility(GameObserver* observer, int id, MTGCardInstance * source, Targetable * target,string _newName,string _castRestriction,string _mayCost, string toAdd, ManaCost * cost = NULL);
int resolve();
const char* getMenuText();
const string getMenuText();
GenericPaidAbility * clone() const;
~GenericPaidAbility();

View File

@@ -33,7 +33,7 @@ protected:
/*
** Tries to render the Big version of a card picture, backups to text version in case of failure
*/
static void RenderBig(MTGCard * card, const Pos& pos);
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false);
static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
static void AlternateRender(MTGCard * card, const Pos& pos);
@@ -55,8 +55,8 @@ public:
virtual void Render();
virtual void Update(float dt);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false);
static JQuadPtr AlternateThumbQuad(MTGCard * card);
virtual ostream& toString(ostream&) const;

View File

@@ -101,10 +101,9 @@ public:
int removeType(string value, int removeAll = 0);
int removeType(int value, int removeAll = 0);
bool hasSubtype(int _subtype);
bool hasSubtype(const char * _subtype);
bool hasSubtype(const string& _subtype);
bool hasType(int _type);
bool hasType(const char * type);
bool hasType(const string& type);
void setManaCost(const string& value);
ManaCost * getManaCost();

View File

@@ -0,0 +1,45 @@
#ifndef _CAROUSEL_DECK_VIEW_H_
#define _CAROUSEL_DECK_VIEW_H_
#include "DeckView.h"
#include "Easing.h"
class CarouselDeckView : public DeckView
{
private:
static const float max_scale;
static const float x_center;
static const float right_border;
static const float slide_animation_duration;
static const float scroll_animation_duration;
public:
CarouselDeckView();
virtual ~CarouselDeckView();
void Reset();
void UpdateViewState(float dt);
void UpdateCardPosition(int index);
void renderCard(int index)
{
int alpha = (int) (255 * (mCards[index].scale + 1.0 - max_scale));
DeckView::renderCard(index, alpha);
}
void Render();
bool ButtonPressed(Buttons button);
MTGCard * Click(int x, int y);
MTGCard * Click();
void changePositionAnimated(int offset);
void changeFilterAnimated(int offset);
MTGCard *getActiveCard();
private:
float mScrollOffset, mSlideOffset;
InOutQuadEasing mScrollEasing;
InOutQuadEasing mSlideEasing;
};
#endif //_CAROUSEL_DECK_VIEW_H_

View File

@@ -17,7 +17,7 @@ private:
StatsWrapper *stw;
public:
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const char * _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
DeckEditorMenu(int id, JGuiListener* listener = NULL, int fontId = 1, const string& _title = "", DeckDataWrapper *selectedDeck = NULL, StatsWrapper *stats = NULL);
void Render();
virtual ~DeckEditorMenu();
};

View File

@@ -79,7 +79,7 @@ public:
virtual void Render();
virtual void Update(float dt);
using JGuiController::Add;
virtual void Add(int id, const char * Text, string desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
virtual void Add(int id, const string& Text, const string& desc = "", bool forceFocus = false, DeckMetaData *deckMetaData = NULL);
virtual void Close();
void updateScroller();
void RenderBackground();

View File

@@ -77,9 +77,7 @@ public:
}
// Setters
void setDescription( const string description ) { mDescription = description; };
;
void setDescription( const string& description ) { mDescription = description; }
};
#endif

View File

@@ -98,7 +98,7 @@ public:
string getManaColorIndex();
void updateStats(string filename, MTGAllCards * collection);
void updateStats(DeckDataWrapper *mtgDeck);
int countCardsByType(const char * _type, DeckDataWrapper * myDeck);
int countCardsByType(const string& _type, DeckDataWrapper * myDeck);
float noLuck(int n, int a, int x);
vector<string> aiDeckNames;

View File

@@ -0,0 +1,241 @@
#ifndef _DECK_VIEW_H_
#define _DECK_VIEW_H_
#include <vector>
#include "MTGCard.h"
#include "DeckDataWrapper.h"
#include "WFont.h"
#include "WResourceManager.h"
#include "Pos.h"
/*! \brief A abstract base class for deck views
*
* The deck editor uses a deck view to present the cards
* e.g. in a circular "Carousel" layout or in a flat grid
* layout. Both layouts inherit this base class to ensure
* a common interface which the deck editor can rely on.
*/
class DeckView
{
protected:
/*! \brief defines the delay until additional card informations get shown
*
* \note I am not entirely sure about that
*/
static const float no_user_activity_show_card_delay;
/*! \brief Represents a card for internal use in the deck view
*
* It stores positional information and a pointer to the actual card structure.
*/
struct CardRep{
float x;
float y;
float scale;
MTGCard * card;
};
public:
/*! \brief Defines if the filter needs an update
*
* The owner of the deck that is shown is responsible for updating the filters.
*/
bool dirtyFilters;
/*! \brief Defines if the card positions need an update
*
* If the card positions are dirty, UpdateCardPosition will get called on
* all cards during Update(float dt);
*
* \see Update
* \see UpdateCardPosition
*/
bool dirtyCardPos;
/*! \brief Constructs the view and initializes datamembers
*
* It sets the dirty states to true, the currently shown deck to NULL and selects filter 0.
*
* \param numberOfCards the number of cards the view handles (this includes hidden cards for caching)
*/
DeckView(int numberOfCards);
/*! \brief Does nothing but is needed to ensure proper deletion of derived classes.
*/
virtual ~DeckView();
/*! \brief Resets nearly all datamembers to their initial values
*
* Does not reset mCards.
*/
virtual void Reset();
/*! \brief Advances the view by dt time units
*
* This method calls UpdateViewState unconditionally and UpdateCardPosition on every card
* if dirtyCardPos is set. It then resets dirtyCardPos.
*
* \param dt the number of time units to advance
* \see UpdateViewState
* \see UpdateCardPosition
*/
void Update(float dt);
/*! \brief Sets the deck that this view shows
*
* This method replaces the currently shown deck with toShow, sets all dirty states and
* reloads the mtg cards. No ownership changes.
*
* \param toShow the deck to show
* \see reloadIndexes
*/
void SetDeck(DeckDataWrapper *toShow);
/*! \brief Returns a pointer to the current deck.
*/
DeckDataWrapper *deck();
/*! \brief Performs an immediate switch of the filter without animations
*
* This method rotates the currently selected filter by delta and sets dirtyFilters.
*
* \param delta the filter to select relatively to the currently selected filter
* \see dirtyFilters
*/
void changeFilter(int delta);
/*! \brief Performs an immediate switch of the position without animations
*
* If the i-th card stored in mCards points to the j-th card in the deck, it will point
* to the (j+delta)-th card after this method is called. No dirty states are set.
*
* \param delta the number of cards to advances
* \see mCards
*/
void changePosition(int delta);
/*! \brief Returns the number of the currently selected filter
*
* \return the currently selected filter
*/
int filter();
/*! \brief Reloads the mtg card pointers of mCards from the deck
*
* This is called when: We change the position in the deck or the deck structure changes
* (due to filtering or addition or removal of cards).
*/
void reloadIndexes();
/*! \brief Returns the current position in the deck
*/
int getPosition();
/*! \brief Renders the view
*/
virtual void Render() = 0;
/*! \brief Reacts to selections by a pointer device (e. g. mouse, touch)
*
* If the selection in view internal i. e. a card got selected, there is
* no outside action performed and this method will return NULL. If a action got
* triggered i. e. a selected card was activated, it returns that card
* for further handling by the caller.
*
* \param x the x coordinate of the pointer during the action
* \param y the y coordinate of the pointer during the action
* \returns the card the action corresponds to
*/
virtual MTGCard * Click(int x, int y) = 0;
/*! \brief Reacts to selections by pointerless devices (e. g. buttons)
*
* \see Click(int x, int y)
* \returns the card the actions corresponds to
*/
virtual MTGCard * Click() = 0;
/*! \brief Handles ordinary button presses
*
* \param the pressed JButton
* \returns true if the view reacted to the button and false otherwise
*/
virtual bool ButtonPressed(Buttons button) = 0;
/*! \brief Returns the currently active card
*/
virtual MTGCard *getActiveCard() = 0;
/*! \brief Changes the position by a given offset
*
* Advances the view by offset cards and animates the change.
*
* \param offset the number of positions to advance
*/
virtual void changePositionAnimated(int offset) = 0;
/*! \brief Changes the filter by a given offset
*
* Rotates the selected filter by the given offset and animates the change.
*/
virtual void changeFilterAnimated(int offset) = 0;
protected:
/*! \brief The number of time units since an user activity occurred
*/
float last_user_activity;
/*! \brief The currently selected filter
*/
int mFilter;
/*! \brief The currently selected deck
*
* This class does not take ownership of the deck
*/
DeckDataWrapper *mCurrentDeck;
/*! \brief The card positions and pointers
*/
vector<CardRep> mCards;
/*! \brief Renders a card with given alpha value
*
* \param index of the card in mCards to render
* \param alpha the alpha value of the card
* \param asThumbnail renders the thumbnail image of the card if set to true
*
* \see mCards
*/
void renderCard(int index, int alpha, bool asThumbnail = false);
/*! \brief Returns the index in mCards of the card that is nearest to the given point
*
* \note This method uses the euclidian distance to the center of the card
*
* \param x the reference points x coordinate
* \param y the reference points y coordinate
* \returns the index of the nearest card to the reference point and -1 of mCards is empty
*/
int getCardIndexNextTo(int x, int y);
private:
/*! \brief Updates the state of the view e. g. view transitions
*
* \param dt the passes time since the last update
*/
virtual void UpdateViewState(float dt) = 0;
/*! \brief Updates the given card reps positional members
*
* This method is called from Update when dirtyCardPos is set
*
* \param index the index in mCards of the card to update
*
* \see Update
* \see mCards
*/
virtual void UpdateCardPosition(int index) = 0;
};
#endif // _DECK_VIEW_H_

View File

@@ -0,0 +1,245 @@
#ifndef _EASING_H_
#define _EASING_H_
/*! \brief A class for eased floats for use in animations
*
* Animations often defines values a floating point variable
* should have at given times and interpolates between them to
* calculate the value of that variable at any given intermediate
* time step.
*
* The simplest case would be linear interpolation:
* Suppose a float "position" should be a at time = 0 and
* b at time = x. If the current time is y, the value of
* "position" is then a + (b-a)*y/x.
*
* This class defines the interface needed to implement different
* kind of interpolations with a common interface. See
* http://www.gizma.com/easing/ for more information for a few
* examples.
*/
class Easing
{
public:
/*! \brief The value at the start of an animation.
*
* start_value is undefined if no animation is running.
*/
float start_value;
/*! \brief The amount the value should change during the animation.
*
* delta_value is undefined if no animation is running.
*/
float delta_value;
/*! \brief The current value.
*
* Use this member to read the value or to write the value without
* to animate intermediate values and. Make sure that the easing
* is not used once value is deleted.
*/
float& value;
/*! \brief The duration the animation should take
*
* It is not relevant which unit is used. This value is undefined
* if no animation is running.
*/
float duration;
/*! \brief The accumulated time the animation did run until now.
*
* It is not relevant which unit is used. This values is undefined
* if no animation is running.
*/
float time_acc;
/*! \brief Sets Easing::float to val and sets the animation as not running.
*
* Make sure that the easing is not used once value is deleted.
*
* \param val The value to ease
*/
Easing(float& val): start_value(val), delta_value(0), value(val), duration(0), time_acc(0)
{
}
/*! \brief Resets the animation to its initial value
*
* This method does set the value to the start value and sets the passed time to 0.
* If there is no animation animation running, the resulting value is undefined.
*/
void reset()
{
value = start_value;
time_acc = 0;
}
/*! \brief Finishes the animation immediately
*
* Sets the value to the animations target value and the passed time to the
* animations duration. If there is no animation running, the behaviour is undefined.
*/
void finish()
{
value = start_value + delta_value;
time_acc = duration;
}
/*! \brief Lets dt time pass
*
* Advances the animation by dt time units and updates the value accordingly.
*
* \val dt The amount of time to jump forward
*/
void update(float dt)
{
if(time_acc < duration)
{
time_acc += dt;
if(time_acc > duration)
{
time_acc = duration;
value = start_value + delta_value;
}
else
{
updateValue();
}
}
}
/*! \brief Calculates the value from all other members.
*
* This method gets implemented by all specific easing classes.
*/
virtual void updateValue() = 0;
/*! \brief Starts the animation.
*
* Starts the interpolation from the current value (now) to
* targetValue (in now + _duration).
*
* If the animation is currently running, it gets replaced.
*
* \param targetValue The value to interpolate to
* \param _duration The duration the interpolation should take
*/
void start(float targetValue, float _duration)
{
start_value = value;
delta_value = targetValue - start_value;
time_acc = 0;
duration = _duration;
}
/*! \brief Translates the current value and the target value by delta_value
*
* This method is mainly used for trickery. Suppose there is one object in the
* middle of the screen that should move to the top until it is outside of the
* screen and gets replaced by a second one entering the screen from the lower
* side once the first one disappeared. This method can be used to simulate this
* effect with one animation by translating (i.e. moving) the animation from the
* top to the bottom:
*
* Object1 and object2 are the same object: object1 whose y position is bound to value
* To start the transition, use start(SCREEN_HEIGHT, desired time); Once the first
* object left the screen (i.e. object.y < 0), change objects appearance to object2
* and translate the easing by (SCREEN_HEIGHT).
*
* \param delta_value The change in start_value and value
*/
void translate(float delta_value)
{
start_value += delta_value;
value += delta_value;
}
/*! \brief Returns if the passed time exceeds duration.
*
* If ther is no animation running, it is ensured that this is true.
*/
bool finished()
{
return time_acc >= duration;
}
};
/*! \brief This class defines an easing with quadratic acceleration
*/
class InQuadEasing : public Easing
{
public:
/*! \brief Calls Easing::Easing(val).
*
* \see Easing::Easing(float& val)
*/
InQuadEasing(float& val): Easing(val) {}
/*! \brief Implements the value calculation.
*
* \see Easing::updateValue()
*/
void updateValue()
{
float time_tmp = time_acc / duration;
value = delta_value * time_tmp * time_tmp + start_value;
}
};
/*! \brief This class defines an easing with quadratic decceleration
*/
class OutQuadEasing : public Easing
{
public:
/*! \brief Calls Easing::Easing(val).
*
* \see Easing::Easing(float& val)
*/
OutQuadEasing(float& val): Easing(val) {}
/*! \brief Implements the value calculation.
*
* \see Easing::updateValue()
*/
void updateValue()
{
float time_tmp = time_acc / duration;
value = (-delta_value) * time_tmp * (time_tmp - 2.0f) + start_value;
}
};
/*! \brief This class defines an easing with quadratic acceleration and decceleration.
*/
class InOutQuadEasing : public Easing
{
public:
/*! \brief Calls Easing::Easing(val).
*
* \see Easing::Easing(float& val)
*/
InOutQuadEasing(float& val): Easing(val) {}
/*! \brief Implements the value calculation.
*
* \see Easing::updateValue()
*/
void updateValue()
{
float time_tmp = (time_acc * 2) / duration;
if (time_tmp < 1)
{
value = (float)(delta_value * 0.5 * time_tmp * time_tmp + start_value);
}
else
{
time_tmp -= 1;
value = (float)(- delta_value * 0.5 * (time_tmp * (time_tmp - 2) - 1) + start_value);
}
}
};
#endif //_EASING_H_

View File

@@ -98,8 +98,8 @@ class GameObserver{
int cardClick(MTGCardInstance * card,Targetable * _object = NULL, bool log = true);
GamePhase getCurrentGamePhase();
void setCurrentGamePhase(GamePhase phase) { mCurrentGamePhase = phase; };
const char * getCurrentGamePhaseName();
const char * getNextGamePhaseName();
const string& getCurrentGamePhaseName();
const string& getNextGamePhaseName();
void nextCombatStep();
void userRequestNextGamePhase(bool allowInterrupt = true, bool log = true);
void cleanupPhase();

View File

@@ -19,22 +19,7 @@
#include "WGui.h"
#include "InteractiveButton.h"
#define NO_USER_ACTIVITY_HELP_DELAY 10
#define NO_USER_ACTIVITY_SHOWCARD_DELAY 0.1
enum
{
STAGE_TRANSITION_RIGHT = 0,
STAGE_TRANSITION_LEFT = 1,
STAGE_WAITING = 2,
STAGE_TRANSITION_UP = 3,
STAGE_TRANSITION_DOWN = 4,
STAGE_ONSCREEN_MENU = 5,
STAGE_WELCOME = 6,
STAGE_MENU = 7,
STAGE_FILTERS = 8,
STAGE_TRANSITION_SELECTED = 9
};
class DeckView;
// TODO: need a better name for MENU_FIRST_MENU, this is reused for the 1st submenu of
// available options in the duel menu
@@ -44,7 +29,7 @@ enum
MENU_DECK_SELECTION = 10,
MENU_DECK_BUILDER = 11,
MENU_FIRST_DUEL_SUBMENU = 102,
MENU_LANGUAGE_SELECTION = 103,
MENU_LANGUAGE_SELECTION = 103
};
// enums for menu options
@@ -64,79 +49,69 @@ enum DECK_VIEWER_MENU_ITEMS
MENU_ITEM_NO = 21,
MENU_ITEM_FILTER_BY = 22,
MENUITEM_MORE_INFO = kInfoMenuID
};
#define ALL_COLORS -1
#define ROTATE_LEFT 1;
#define ROTATE_RIGHT 0;
#define HIGH_SPEED 15.0
#define MED_SPEED 5.0f
#define LOW_SPEED 1.5
#define MAX_SAVED_FILTERS Constants::NB_Colors + 1
#define CARDS_DISPLAYED 10
class GameStateDeckViewer: public GameState, public JGuiListener
{
private:
enum DeckViewerStages
{
STAGE_WAITING = 0,
STAGE_ONSCREEN_MENU,
STAGE_WELCOME,
STAGE_MENU,
STAGE_FILTERS
};
vector<JQuadPtr> mIcons;
JQuadPtr pspIcons[8];
JTexture * pspIconsTexture;
float last_user_activity;
float onScreenTransition;
float mRotation;
float mSlide;
int mAlpha;
int mStage;
int useFilter;
DeckViewerStages mStage;
JMusic * bgMusic;
int lastPos;
int lastTotal;
int mSelected;
InteractiveButton *toggleDeckButton, *sellCardButton, *statsPrevButton, *filterButton;
InteractiveButton *toggleDeckButton, *sellCardButton, *statsPrevButton, *filterButton, *toggleViewButton;
WGuiFilters * filterMenu;
WSrcDeckViewer * source;
DeckEditorMenu * welcome_menu;
SimpleMenu * subMenu;
DeckEditorMenu * menu;
DeckEditorMenu * deckMenu;
PriceList* pricelist;
PlayerData * playerdata;
int price;
DeckDataWrapper * displayed_deck;
DeckDataWrapper * myDeck;
DeckDataWrapper * myCollection;
MTGCard * cardIndex[CARDS_DISPLAYED];
StatsWrapper *stw;
StatsWrapper * mStatsWrapper;
int hudAlpha;
string newDeckname;
bool isAIDeckSave;
bool mSwitching;
enum AvailableView{
CAROUSEL_VIEW,
GRID_VIEW
};
DeckView* mView;
AvailableView mCurrentView;
void saveDeck(); //Saves the deck and additional necessary information
void saveAsAIDeck(string deckName); // saves deck as an AI Deck
int getCurrentPos();
void sellCard();
void setButtonState(bool state);
bool userPressedButton();
void RenderButtons();
pair<float, float> cardsCoordinates[CARDS_DISPLAYED];
void setupView(AvailableView view, DeckDataWrapper *deck);
void toggleView();
public:
GameStateDeckViewer(GameApp* parent);
virtual ~GameStateDeckViewer();
void updateDecks();
void rotateCards(int direction);
void loadIndexes();
void updateFilters();
void rebuildFilters();
void switchDisplay();
void toggleCollection();
void Start();
virtual void End();
void addRemove(MTGCard * card);
@@ -145,11 +120,8 @@ public:
void renderSlideBar();
void renderDeckBackground();
void renderOnScreenMenu();
virtual void renderCard(int id, float rotation);
virtual void renderCard(int id);
virtual void Render();
int loadDeck(int deckid);
void LoadDeckStatistics(int deckId);
void OnScroll(int inXVelocity, int inYVelocity);

View File

@@ -65,7 +65,6 @@ private:
JQuadPtr pspIcons[8];
WSrcCards * srcCards;
TaskList * taskList;
float mElapsed;
WGuiMenu * shopMenu;
WGuiFilters * filterMenu; //Filter menu slides in sideways from right, or up from bottom.
WGuiCardImage * bigDisplay;

View File

@@ -0,0 +1,154 @@
#ifndef _GRID_DECK_VIEW_H
#define _GRID_DECK_VIEW_H
#include "DeckView.h"
#include "Easing.h"
/*! \brief Implements a grid view
*
* This view displays 12 cards in two rows as thumbnails. The currently
* selected card is dislayed bigger than the rest and uses the fullsize
* image. Scrolling the view horizontally and toggeling filters is
* animated and uses quadratic easing.
*
* It also implements a button mode for pointerless devices.
*/
class GridDeckView : public DeckView
{
private:
static const float scroll_animation_duration;
static const float slide_animation_duration;
static const float card_scale_small;
static const float card_scale_big;
public:
/*! \brief Constructs a grid view with no decks set
*/
GridDeckView();
/*! \brief Does nothing but is needed to ensure proper deletion of derived classes.
*/
virtual ~GridDeckView();
/*! \brief Resets almost all member variables but mRows and mCols
*/
void Reset();
/*! \brief Advances scrolling and sliding animations
*
* \param dt the time since the last update
*
* \see DeckView::UpdateViewState()
*/
void UpdateViewState(float dt);
/*! \brief Updates the cards position
*
* \see DeckView::UpdateCardPosition()
*/
void UpdateCardPosition(int index);
/*! \brief Renders the view
*
* This method prefetches all rendered cards as thumbnails except the
* selected card to reduce cache pressure.
*/
void Render();
/*! \brief Handles button presses
*
* The mapping is as follows:
* JGE_BTN_LEFT moves the position to the left if not in button mode
* moves the selection otherwise
* JGE_BTN_RIGHT move the position to the right if not in button mode
* moves the selection otherwise
* JGE_BTN_UP select the previous filter if not in button mode
* moves the selection otherwise
* JGE_BTN_DOWN select the next filter if not in button mode
* moves the selection otherwise
* JGE_BTN_CTRL deactivate button mode
*
* \param button the pressed button
* \returns if the view handled the button
*/
bool ButtonPressed(Buttons button);
/*! \brief Handles clicks and triggers scrolling and the selection of cards
*
* This method deactivates the button mode and searches for the nearest
* card to the given position. If this card is in column 0 or 1 it scrolls
* left. If it is in column (mCols-1) or (mCols-2) it scrolls to the right.
* In any other case, it selects the card.
*
* \param x the clicks x coordinate
* \param y the clicks y coordinate
*
* \return selected card c if c was already selected and no animation is running, NULL otherwise
*/
MTGCard * Click(int x, int y);
/*! \brief Handles pointerless clicks (JGE_BTN_OK)
*
* If no card is selected, this method activates button mode and selects a card.
*
* \returns selected card, NULL otherwise
*/
MTGCard * Click();
/*! \brief Scrolls the view horizontally
*
* \param offset the number of columns to scroll
*/
void changePositionAnimated(int offset);
/*! \brief Rotates the selected filter and slides vertically
*
* \param the number of filters to rotate
*/
void changeFilterAnimated(int offset);
/*! \brief Returns the currently selected card
*
* \returns card c if c is selected and in column 4 to 6 and NULL otherwise*/
MTGCard *getActiveCard();
private:
/*! \brief The amount of columns (visible and hidden)
*/
const int mCols;
/*! \brief The amount of rows
*/
const int mRows;
/*! \brief The current scrolling offset
*/
float mScrollOffset;
/*! \brief The current sliding offset
*/
float mSlideOffset;
/*! \brief The easing functor that gets applied while scrolling
*/
InOutQuadEasing mScrollEasing;
/*! \brief The easing functor that gets applied while sliding
*/
InOutQuadEasing mSlideEasing;
/*! \brief The current selected card index
*/
int mCurrentSelection;
/*! \brief Stores if we are in button mode.
*/
bool mButtonMode;
/*! \brief Moves the card selection by an offset.
*
* \param offset the offset to move the selection
* \param alignIfOutOfBounds the view will scroll if the selection moves out of bound if set to true
*/
void moveSelection(int offset, bool alignIfOutOfBounds);
};
#endif //_GRID_DECK_VIEW_H

View File

@@ -6,8 +6,9 @@
#include <hge/hgeparticle.h>
#include "JGE.h"
#include "MTGDefinitions.h"
#include "GameApp.h"
#include "Pos.h"
#include "GuiLayers.h"
#include "WResource_Fwd.h"
class ManaIcon : public Pos
{

View File

@@ -4,15 +4,25 @@
#include "GuiLayers.h"
#include "PhaseRing.h"
#include "WEvent.h"
#include "PlayGuiObject.h"
#include "Easing.h"
class GuiPhaseBar: public GuiLayer, public PlayGuiObject
{
protected:
Phase* phase;
private:
static const float zoom_big;
static const float zoom_small;
static const float step;
int displayedPhaseId;
float angle;
float zoomFactor;
DuelLayers* mpDuelLayers;
OutQuadEasing angleEasing;
InOutQuadEasing zoomFactorEasing;
DuelLayers* mpDuelLayers;
void DrawGlyph(JQuad *inQuad, int phaseId, float x, float y, float scale);
public:
GuiPhaseBar(DuelLayers* duelLayers);
~GuiPhaseBar();

View File

@@ -28,6 +28,7 @@ const int kNextStatsButtonId = 10005;
const int kPrevStatsButtonId = 10006;
const int kCycleCardsButtonId = 10007;
const int kShowCardListButtonId = 10008;
const int kSwitchViewButton = 10009;
class InteractiveButton: public SimpleButton
{

View File

@@ -317,7 +317,7 @@ public:
virtual TargetAbility* clone() const = 0;
virtual void Render();
virtual int resolve();
virtual const char * getMenuText();
virtual const string getMenuText();
virtual ostream& toString(ostream& out) const;
};
@@ -436,7 +436,7 @@ public:
void Update(float dt);
virtual GenericTriggeredAbility* clone() const;
const char * getMenuText();
const string getMenuText();
~GenericTriggeredAbility();
};
@@ -525,7 +525,7 @@ public:
int isReactingToClick(MTGCardInstance * _card, ManaCost * mana = NULL);
int resolve();
int reactToClick(MTGCardInstance* _card);
const char * getMenuText();
const string getMenuText();
~AManaProducer();
virtual AManaProducer * clone() const;
};

View File

@@ -129,11 +129,11 @@ public:
//types
void addType(char * type_text);
void addType(const string& type_text);
virtual void addType(int id);
void setType(const char * type_text);
void setSubtype( string value);
int removeType(string value, int removeAll = 0);
void setType(const string& type_text);
void setSubtype(const string &value);
int removeType(const string &value, int removeAll = 0);
int removeType(int value, int removeAll = 0);
//dangerranking is a hint to Ai which creatures are the ones it should be targetting for effects.

View File

@@ -4,7 +4,6 @@
#define MTG_ERROR -1
#include "MTGDefinitions.h"
#include "GameApp.h"
#include "WResourceManager.h"
#include <dirent.h>
#include <Threading.h>
@@ -19,7 +18,7 @@ class MTGPack;
class MTGSetInfo
{
public:
MTGSetInfo(string _id);
MTGSetInfo(const string& _id);
~MTGSetInfo();
string id; //Short name: 10E, RAV, etc. Automatic from folder.
string author; //Author of set, for crediting mod makers, etc.
@@ -70,7 +69,7 @@ public:
MTGSets();
~MTGSets();
int Add(const char * subtype);
int Add(const string& subtype);
int findSet(string value);
int findBlock(string s);
int size();
@@ -127,8 +126,10 @@ public:
MTGCard * getCardByName(string name);
void loadFolder(const string& folder, const string& filename="" );
int load(const char * config_file, const char * setName = NULL, int autoload = 1);
int countByType(const char * _type);
int load(const string& config_file);
int load(const string& config_file, const string& setName);
int load(const string& config_file, int set_id);
int countByType(const string& _type);
int countByColor(int color);
int countBySet(int setId);
int totalCards();
@@ -136,7 +137,7 @@ public:
static int findType(string subtype, bool forceAdd = true) {
boost::mutex::scoped_lock lock(instance->mMutex);
int result = instance->subtypesList.find(subtype, forceAdd);
int result = instance->subtypesList.find(subtype, forceAdd);
return result;
};
static int add(string value, unsigned int parentType) {
@@ -218,8 +219,8 @@ public:
int totalCards();
int totalPrice();
MTGDeck(MTGAllCards * _allcards);
MTGDeck(const char * config_file, MTGAllCards * _allcards, int meta_only = 0,int difficultySetting = 0);
int addRandomCards(int howmany, int * setIds = NULL, int nbSets = 0, int rarity = -1, const char * subtype = NULL,
MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_only = 0,int difficultySetting = 0);
int addRandomCards(int howmany, int * setIds = NULL, int nbSets = 0, int rarity = -1, const string& subtype = "",
int * colors = NULL, int nbcolors = 0);
int add(int cardid);
int add(MTGDeck * deck); // adds the contents of "deck" into myself

View File

@@ -218,7 +218,8 @@ class Constants
soulbond = 100,
LURE = 101,
NOLEGEND = 102,
NB_BASIC_ABILITIES = 103,
CANPLAYFROMGRAVEYARD = 103,
NB_BASIC_ABILITIES = 104,
RARITY_S = 'S', //Special Rarity
@@ -293,7 +294,7 @@ class Constants
static map<string,int> MTGBasicAbilitiesMap;
static const char* MTGBasicAbilities[];
static const char* MTGPhaseNames[];
static const string MTGPhaseNames[];
static const char* MTGPhaseCodeNames[];
static int GetBasicAbilityIndex(string mtgAbility);

View File

@@ -95,7 +95,7 @@ class MTGGameZone {
void cleanupPhase();
void beforeBeginPhase();
unsigned int countByType(const char * value);
unsigned int countByType(const string &value);
unsigned int countByCanTarget(TargetChooser * tc);
unsigned int countTotalManaSymbols(TargetChooser * tc, int color);
MTGCardInstance * findByName(string name);

View File

@@ -66,6 +66,7 @@ public:
MTGEventBonus(GameObserver* observer, int _id);
virtual MTGEventBonus * clone() const;
};
class MTGPutInPlayRule: public PermanentAbility
{
public:
@@ -73,7 +74,7 @@ public:
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGPutInPlayRule(GameObserver* observer, int _id);
const char * getMenuText()
const string getMenuText()
{
return "cast card normally";
}
@@ -87,7 +88,7 @@ public:
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGKickerRule(GameObserver* observer, int _id);
const char * getMenuText()
const string getMenuText()
{
return "pay kicker";
}
@@ -105,7 +106,7 @@ public:
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGAlternativeCostRule(GameObserver* observer, int _id);
const char * getMenuText()
const string getMenuText()
{
if(alternativeName.size())
return alternativeName.c_str();
@@ -121,7 +122,7 @@ public:
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGBuyBackRule(GameObserver* observer, int _id);
const char * getMenuText()
const string getMenuText()
{
return "cast and buy back";
}
@@ -136,7 +137,7 @@ public:
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGFlashBackRule(GameObserver* observer, int _id);
const char * getMenuText()
const string getMenuText()
{
return "flash back";
}
@@ -150,7 +151,7 @@ public:
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGRetraceRule(GameObserver* observer, int _id);
const char * getMenuText()
const string getMenuText()
{
return "retrace";
}
@@ -165,13 +166,28 @@ public:
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGMorphCostRule(GameObserver* observer, int _id);
const char * getMenuText()
const string getMenuText()
{
return "play morphed";
}
virtual MTGMorphCostRule * clone() const;
};
class MTGPlayFromGraveyardRule: public MTGAlternativeCostRule
{
public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGPlayFromGraveyardRule(GameObserver* observer, int _id);
const string getMenuText()
{
return "cast card from graveyard";
}
virtual MTGPlayFromGraveyardRule * clone() const;
};
class MTGSuspendRule: public MTGAlternativeCostRule
{
public:
@@ -181,7 +197,7 @@ public:
string suspendmenu;
virtual ostream& toString(ostream& out) const;
MTGSuspendRule(GameObserver* observer, int _id);
const char * getMenuText();
const string getMenuText();
virtual MTGSuspendRule * clone() const;
};
@@ -195,7 +211,7 @@ public:
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGAttackRule(GameObserver* observer, int _id);
const char * getMenuText()
const string getMenuText()
{
return "Attacker";
}
@@ -213,7 +229,7 @@ public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
MTGPlaneswalkerAttackRule(GameObserver* observer, int _id);
const char * getMenuText()
const string getMenuText()
{
return "Attack Planeswalker";
}
@@ -226,7 +242,7 @@ public:
MTGCardInstance* attacker;
AAPlaneswalkerAttacked(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target);
int resolve();
const char* getMenuText();
const string getMenuText();
AAPlaneswalkerAttacked * clone() const;
~AAPlaneswalkerAttacked();
};
@@ -252,7 +268,7 @@ public:
int reactToClick(MTGCardInstance * card);
virtual ostream& toString(ostream& out) const;
MTGBlockRule(GameObserver* observer, int _id);
const char * getMenuText();
const string getMenuText();
virtual MTGBlockRule * clone() const;
~MTGBlockRule();
};
@@ -386,7 +402,7 @@ public:
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card);
int reactToClick(MTGCardInstance * card, int id);
const char * getMenuText()
const string getMenuText()
{
return "Momir";
}
@@ -406,7 +422,7 @@ public:
MTGCardInstance * genEquip(int id);
MTGStoneHewerRule(GameObserver* observer, int _id, MTGAllCards * _collection);
int receiveEvent(WEvent * event);
const char * getMenuText()
const string getMenuText()
{
return "Stone Hewer";
}
@@ -419,7 +435,7 @@ class MTGHermitRule: public PermanentAbility
public:
MTGHermitRule(GameObserver* observer, int _id);
int receiveEvent(WEvent * event);
const char * getMenuText()
const string getMenuText()
{
return "Hermit";
}
@@ -447,7 +463,7 @@ public:
int receiveEvent(WEvent * event);
const char * getMenuText()
const string getMenuText()
{
return "Deathtouch";
}

View File

@@ -1,6 +1,8 @@
#ifndef OBJECTANALYTICS_H
#define OBJECTANALYTICS_H
#include <boost/cstdint.hpp>
#ifdef _DEBUG
#define TRACK_OBJECT_USAGE
#endif

View File

@@ -7,7 +7,6 @@
#include <JGui.h>
#include <vector>
#include <string>
#include "GameApp.h"
#include "GameStateOptions.h"
#include "WFilter.h"
#include "WDataSrc.h"

View File

@@ -62,7 +62,7 @@ public:
int addCombatAfter(Player* player, int after_id, bool withMain = false);
int addPhaseAfter(GamePhase id, Player* player, int after_id);
int removePhase(int id);
const char * phaseName(int id);
const string& phaseName(int id);
static GamePhase phaseStrToInt(string s);
static string phaseIntToStr(int id);

View File

@@ -20,16 +20,18 @@ public:
~PriceList();
int save();
int getSellPrice(int cardid);
int getSellPrice(MTGCard* card);
int getPurchasePrice(int cardid);
int getPrice(MTGCard *card);
int getPrice(int cardId);
int setPrice(int cardId, int price);
int setPrice(MTGCard *card, int price);
int getOtherPrice(int amt);
static float difficultyScalar(float price, int cardid = 0);
static void updateKey()
{
randomKey = rand();
}
;
};
#endif

View File

@@ -43,7 +43,7 @@ public:
virtual bool CheckUserInput(JButton key);
virtual void Update(float dt);
using JGuiController::Add;
virtual void Add(int id, const char * Text, string desc = "", bool forceFocus = false);
virtual void Add(int id, const string &Text, string desc = "", bool forceFocus = false);
int getmCurr(){return mCurr;}
float getWidth(){return mWidth; }
virtual void Close();

View File

@@ -2,6 +2,15 @@
#define TASK_H
#include <vector>
#include <string>
#include "Easing.h"
using namespace std;
class GameObserver;
class JQuad;
class JTexture;
// Task type constant
@@ -70,8 +79,11 @@ class TaskList
{
protected:
string fileName;
float vPos;
float mElapsed;
OutQuadEasing vPosInEasing;
InQuadEasing vPosOutEasing;
int mState;
JQuad * mBg[9];
JTexture * mBgTex;
@@ -95,7 +107,6 @@ public:
{
return mState;
}
;
void addTask(string params, bool rand = false);
void addTask(Task *task);
void addRandomTask(int diff = 100);

View File

@@ -1,3 +1,5 @@
#include "MTGDeck.h"
#ifndef _WFILTER_H_
#define _WFILTER_H_
/**

View File

@@ -8,6 +8,7 @@
class hgeDistortionMesh;
class GameStateOptions;
class SimpleMenu;
/**
@defgroup WGui Basic Gui

View File

@@ -26,6 +26,7 @@
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <list>
#include "DebugRoutines.h"
@@ -140,4 +141,20 @@ template <class T> istream& operator>>(istream& in, T& p)
/* replace_all ... replacement to avoid depending on boost for that */
void ReplaceString(std::string& subject, const std::string& search, const std::string& replace);
/*! \brief Returns true if base starts with start, otherwise false
*
* Compares the first strlen(start) characters of base with start and
* returns true if both match.
*/
bool StartsWith(const std::string& base, const char *start);
/*! \brief Returns true if base starts with start, otherwise false
*
* This version is slightly more efficient as strlen does not need to
* get called. Otherwise, it behaves exactly like
* StartsWith(const std::string& base, const char *start)
*
* \see StartsWith(const std::string& base, const char *start)
*/
bool StartsWith(const std::string& base, const std::string& start);
#endif

View File

@@ -57,7 +57,7 @@ void NextGamePhase::Render()
if (observer->currentActionPlayer == observer->players[1])
playerId = 2;
sprintf(buffer, "%s %i : %s", _("Player").c_str(), playerId, observer->getNextGamePhaseName());
sprintf(buffer, "%s %i : %s", _("Player").c_str(), playerId, observer->getNextGamePhaseName().c_str());
mFont->DrawString(buffer, x + 15, y+10, JGETEXT_LEFT);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
@@ -675,6 +675,7 @@ ActionStack::ActionStack(GameObserver* game)
currentState = -1;
mode = ACTIONSTACK_STANDARD;
checked = 0;
lastActionController = NULL;
if(!observer->getResourceManager()) return;
for (int i = 0; i < 8; ++i)

View File

@@ -55,6 +55,12 @@ GenericActivatedAbility::GenericActivatedAbility(GameObserver* observer, string
target = ability->target;
}
GenericActivatedAbility::GenericActivatedAbility(const GenericActivatedAbility &other):
ActivatedAbility(other), NestedAbility(other), activeZone(other.activeZone), newName(other.newName)
{
}
int GenericActivatedAbility::resolve()
{
//Note: I've seen a similar block in some other MTGAbility, can this be refactored .
@@ -71,7 +77,7 @@ int GenericActivatedAbility::resolve()
return 0;
}
const char * GenericActivatedAbility::getMenuText()
const string GenericActivatedAbility::getMenuText()
{
if(newName.size())
return newName.c_str();
@@ -105,6 +111,7 @@ int GenericActivatedAbility::testDestroy()
GenericActivatedAbility * GenericActivatedAbility::clone() const
{
GenericActivatedAbility * a = NEW GenericActivatedAbility(*this);
a->ability = ability->clone();
return a;
}
@@ -133,7 +140,7 @@ int AAAlterPoison::resolve()
return 0;
}
const char * AAAlterPoison::getMenuText()
const string AAAlterPoison::getMenuText()
{
return "Poison";
}
@@ -165,7 +172,7 @@ int AADamagePrevent::resolve()
return 0;
}
const char * AADamagePrevent::getMenuText()
const string AADamagePrevent::getMenuText()
{
return "Prevent Damage";
}
@@ -237,7 +244,7 @@ AADamager::AADamager(GameObserver* observer, int _id, MTGCardInstance * _source,
return damage.getValue();
}
const char * AADamager::getMenuText()
const string AADamager::getMenuText()
{
MTGCardInstance * _target = dynamic_cast<MTGCardInstance*>(target);
if(_target && _target->hasType(Subtypes::TYPE_PLANESWALKER))
@@ -276,7 +283,7 @@ AADepleter::AADepleter(GameObserver* observer, int _id, MTGCardInstance * card,
return 1;
}
const char * AADepleter::getMenuText()
const string AADepleter::getMenuText()
{
return "Deplete";
}
@@ -311,7 +318,7 @@ AAModTurn::AAModTurn(GameObserver* observer, int _id, MTGCardInstance * card, Ta
return 1;
}
const char * AAModTurn::getMenuText()
const string AAModTurn::getMenuText()
{
WParsedInt numTurns(nbTurnStr, NULL, source);
if(numTurns.getValue() > 0)
@@ -354,7 +361,7 @@ int AALibraryBottom::resolve()
return 0;
}
const char * AALibraryBottom::getMenuText()
const string AALibraryBottom::getMenuText()
{
return "Bottom Of Library";
}
@@ -382,7 +389,7 @@ int AACopier::resolve()
return 0;
}
const char * AACopier::getMenuText()
const string AACopier::getMenuText()
{
return "Copy";
}
@@ -415,7 +422,7 @@ int AAPhaseOut::resolve()
return 0;
}
const char * AAPhaseOut::getMenuText()
const string AAPhaseOut::getMenuText()
{
return "Phase Out";
}
@@ -506,7 +513,7 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
return 0;
}
const char* AACounter::getMenuText()
const string AACounter::getMenuText()
{
if (menu.size())
{
@@ -695,7 +702,7 @@ int AARemoveAllCounter::resolve()
return nb;
}
const char* AARemoveAllCounter::getMenuText()
const string AARemoveAllCounter::getMenuText()
{
if (menu.size())
{
@@ -773,7 +780,7 @@ int AAProliferate::resolve()
}
const char* AAProliferate::getMenuText()
const string AAProliferate::getMenuText()
{
return "Proliferate";
}
@@ -816,13 +823,13 @@ int GenericChooseTypeColor::resolve()
for (size_t i = 0; i < values.size(); ++i)
{
string menu = values[i];
if(!ANonWall || (menu != "wall" && menu != "Wall"))
if (!ANonWall || (menu != "wall" && menu != "Wall"))
{
setType = NEW AASetTypeChosen(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, i,menu,baseAbility);
MTGAbility * set = setType->clone();
set->oneShot = true;
selection.push_back(set);
SAFE_DELETE(setType);
setType = NEW AASetTypeChosen(game, game->mLayers->actionLayer()->getMaxId(), source,(MTGCardInstance*)target, i,menu,baseAbility);
MTGAbility * set = setType->clone();
set->oneShot = true;
selection.push_back(set);
SAFE_DELETE(setType);
}
}
}
@@ -837,7 +844,7 @@ int GenericChooseTypeColor::resolve()
}
const char* GenericChooseTypeColor::getMenuText()
const string GenericChooseTypeColor::getMenuText()
{
if(chooseColor)
return "Choose a color";
@@ -899,7 +906,7 @@ int AASetColorChosen::resolve()
return 1;
}
const char* AASetColorChosen::getMenuText()
const string AASetColorChosen::getMenuText()
{
return Constants::MTGColorStrings[color];
}
@@ -956,7 +963,7 @@ int AASetTypeChosen::resolve()
return 1;
}
const char* AASetTypeChosen::getMenuText()
const string AASetTypeChosen::getMenuText()
{
return menutext.c_str();
}
@@ -1003,7 +1010,7 @@ int GenericFlipACoin::resolve()
}
const char* GenericFlipACoin::getMenuText()
const string GenericFlipACoin::getMenuText()
{
return "Flip A Coin";
}
@@ -1095,7 +1102,7 @@ int AASetCoin::resolve()
return 1;
}
const char* AASetCoin::getMenuText()
const string AASetCoin::getMenuText()
{
if(side == 1)
return "Tails";
@@ -1186,7 +1193,7 @@ int GenericPaidAbility::resolve()
return 1;
}
const char* GenericPaidAbility::getMenuText()
const string GenericPaidAbility::getMenuText()
{
if (newName.size())
return newName.c_str();
@@ -1288,7 +1295,7 @@ int AAResetDamage::resolve()
return 1;
}
const char* AAResetDamage::getMenuText()
const string AAResetDamage::getMenuText()
{
return "Reset Damages";
}
@@ -1309,7 +1316,7 @@ int AAFakeAbility::resolve()
return 1;
}
const char* AAFakeAbility::getMenuText()
const string AAFakeAbility::getMenuText()
{
if(named.size())
return named.c_str();
@@ -1356,7 +1363,7 @@ int AAFizzler::resolve()
return 1;
}
const char * AAFizzler::getMenuText()
const string AAFizzler::getMenuText()
{
return "Fizzle";
}
@@ -1403,7 +1410,7 @@ int AABuryCard::resolve()
return 0;
}
const char * AABuryCard::getMenuText()
const string AABuryCard::getMenuText()
{
if(menu.size())
return menu.c_str();
@@ -1459,7 +1466,7 @@ int AADestroyCard::resolve()
return 0;
}
const char * AADestroyCard::getMenuText()
const string AADestroyCard::getMenuText()
{
return "Destroy";
}
@@ -1515,7 +1522,7 @@ int AASacrificeCard::resolve()
return 0;
}
const char * AASacrificeCard::getMenuText()
const string AASacrificeCard::getMenuText()
{
return "Sacrifice";
}
@@ -1570,7 +1577,7 @@ int AADiscardCard::resolve()
return 0;
}
const char * AADiscardCard::getMenuText()
const string AADiscardCard::getMenuText()
{
return "Discard";
}
@@ -1634,7 +1641,7 @@ AADrawer::AADrawer(GameObserver* observer, int _id, MTGCardInstance * card, Targ
return numCards.getValue();
}
const char * AADrawer::getMenuText()
const string AADrawer::getMenuText()
{
return "Draw";
}
@@ -1663,7 +1670,7 @@ int AAFrozen::resolve()
return 1;
}
const char * AAFrozen::getMenuText()
const string AAFrozen::getMenuText()
{
return "Freeze";
}
@@ -1728,7 +1735,7 @@ int AANewTarget::resolve()
return 1;
}
const char * AANewTarget::getMenuText()
const string AANewTarget::getMenuText()
{
return "New Target";
}
@@ -1809,7 +1816,7 @@ int AAMorph::testDestroy()
return 0;
}
const char * AAMorph::getMenuText()
const string AAMorph::getMenuText()
{
return "Morph";
}
@@ -1946,7 +1953,7 @@ int AAFlip::testDestroy()
return 0;
}
const char * AAFlip::getMenuText()
const string AAFlip::getMenuText()
{
string s = flipStats;
sprintf(menuText, "Transform:%s", s.c_str());
@@ -2252,7 +2259,7 @@ int AADynamic::activateStored()
return 1;
}
const char * AADynamic::getMenuText()
const string AADynamic::getMenuText()
{
if (menu.size())
{
@@ -2367,7 +2374,7 @@ int AALifer::getLife()
return life.getValue();
}
const char * AALifer::getMenuText()
const string AALifer::getMenuText()
{
if(getLife() < 0)
return "Life Loss";
@@ -2400,7 +2407,7 @@ int AASetHand::resolve()
return 1;
}
const char * AASetHand::getMenuText()
const string AASetHand::getMenuText()
{
return "Set Hand Size";
}
@@ -2431,7 +2438,7 @@ int AALifeSet::resolve()
return 1;
}
const char * AALifeSet::getMenuText()
const string AALifeSet::getMenuText()
{
return "Set Life";
}
@@ -2513,7 +2520,7 @@ int AACloner::resolve()
}
const char * AACloner::getMenuText()
const string AACloner::getMenuText()
{
if (who == 1)
return "Clone For Opponent";
@@ -2588,7 +2595,7 @@ int ACastRestriction::destroy()
return 1;
}
const char * ACastRestriction::getMenuText()
const string ACastRestriction::getMenuText()
{
if (modifyExisting)
return "Additional Lands"; //hardoced because only the lands rule allows to modify existing rule for now
@@ -2623,7 +2630,7 @@ int AInstantCastRestrictionUEOT::resolve()
wrapper->addToGame();
return 1;
}
const char * AInstantCastRestrictionUEOT::getMenuText()
const string AInstantCastRestrictionUEOT::getMenuText()
{
return ability->getMenuText();
}
@@ -2717,14 +2724,14 @@ int AAMover::resolve()
return 0;
}
const char * AAMover::getMenuText()
const string AAMover::getMenuText()
{
if(named.size())
return named.c_str();
return "Move";
}
const char * AAMover::getMenuText(TargetChooser * tc)
const char* AAMover::getMenuText(TargetChooser * tc)
{
if(named.size())
return named.c_str();
@@ -2864,7 +2871,7 @@ int AARandomMover::resolve()
return 0;
}
const char * AARandomMover::getMenuText()
const string AARandomMover::getMenuText()
{
return "Dig";
}
@@ -2902,7 +2909,7 @@ int AARandomDiscarder::resolve()
return 1;
}
const char * AARandomDiscarder::getMenuText()
const string AARandomDiscarder::getMenuText()
{
return "Discard Random";
}
@@ -2929,7 +2936,7 @@ int AAShuffle::resolve()
return 1;
}
const char * AAShuffle::getMenuText()
const string AAShuffle::getMenuText()
{
return "Shuffle";
}
@@ -3027,7 +3034,7 @@ int AARemoveMana::resolve()
return 1;
}
const char * AARemoveMana::getMenuText()
const string AARemoveMana::getMenuText()
{
if (mRemoveAll && !mManaDesc)
return "Empty Manapool";
@@ -3066,7 +3073,7 @@ int AATapper::resolve()
return 1;
}
const char * AATapper::getMenuText()
const string AATapper::getMenuText()
{
return "Tap";
}
@@ -3096,7 +3103,7 @@ int AAUntapper::resolve()
return 1;
}
const char * AAUntapper::getMenuText()
const string AAUntapper::getMenuText()
{
return "Untap";
}
@@ -3177,7 +3184,7 @@ int AAWinGame::resolve()
return 1;
}
const char * AAWinGame::getMenuText()
const string AAWinGame::getMenuText()
{
return "Win Game";
}
@@ -3268,7 +3275,7 @@ int IfThenAbility::resolve()
return 0;
}
const char * IfThenAbility::getMenuText()
const string IfThenAbility::getMenuText()
{
return "";
}
@@ -3320,7 +3327,7 @@ void MayAbility::Update(float dt)
}
}
const char * MayAbility::getMenuText()
const string MayAbility::getMenuText()
{
return ability->getMenuText();
}
@@ -3456,7 +3463,7 @@ int MenuAbility::resolve()
return a->addToGame();
}
const char * MenuAbility::getMenuText()
const string MenuAbility::getMenuText()
{
if((abilities.size() > 1 && must)||(abilities.size() > 2 && !must))
return "choose one";
@@ -3657,7 +3664,7 @@ int MultiAbility::destroy()
return ActivatedAbility::destroy();
}
const char * MultiAbility::getMenuText()
const string MultiAbility::getMenuText()
{
if (abilities.size() && abilities[0])
return abilities[0]->getMenuText();
@@ -3696,7 +3703,7 @@ GenericTargetAbility::GenericTargetAbility(GameObserver* observer, string newNam
counters = 0;
}
const char * GenericTargetAbility::getMenuText()
const string GenericTargetAbility::getMenuText()
{
if (!ability)
return "Error";
@@ -4249,7 +4256,7 @@ int ATransformer::destroy()
return 1;
}
const char * ATransformer::getMenuText()
const string ATransformer::getMenuText()
{
if(menutext.size())
return menutext.c_str();
@@ -4282,7 +4289,7 @@ int ATransformerInstant::resolve()
wrapper->addToGame();
return 1;
}
const char * ATransformerInstant::getMenuText()
const string ATransformerInstant::getMenuText()
{
if(menu.size())
return menu.c_str();
@@ -4316,7 +4323,7 @@ int PTInstant::resolve()
wrapper->addToGame();
return 1;
}
const char * PTInstant::getMenuText()
const string PTInstant::getMenuText()
{
return ability->getMenuText();
}
@@ -4347,7 +4354,7 @@ int ASwapPTUEOT::resolve()
return 1;
}
const char * ASwapPTUEOT::getMenuText()
const string ASwapPTUEOT::getMenuText()
{
return ability->getMenuText();
}
@@ -4417,7 +4424,7 @@ int AAExchangeLife::resolve()
return 0;
}
const char * AAExchangeLife::getMenuText()
const string AAExchangeLife::getMenuText()
{
return "Exchange life";
}
@@ -4655,7 +4662,7 @@ int APreventDamageTypesUEOT::destroy()
return 1;
}
const char * APreventDamageTypesUEOT::getMenuText()
const string APreventDamageTypesUEOT::getMenuText()
{
return ability->getMenuText();
}
@@ -4725,7 +4732,7 @@ int AVanishing::resolve()
return 1;
}
const char * AVanishing::getMenuText()
const string AVanishing::getMenuText()
{
if(counterName.find("fade") != string::npos)
return "Fading";
@@ -4821,7 +4828,7 @@ int AUpkeep::resolve()
return 1;
}
const char * AUpkeep::getMenuText()
const string AUpkeep::getMenuText()
{
return "Upkeep";
}
@@ -4921,7 +4928,7 @@ int APhaseAction::resolve()
return 0;
}
const char * APhaseAction::getMenuText()
const string APhaseAction::getMenuText()
{
if(psMenuText.size())
return psMenuText.c_str();
@@ -4958,7 +4965,7 @@ int APhaseActionGeneric::resolve()
return 1;
}
const char * APhaseActionGeneric::getMenuText()
const string APhaseActionGeneric::getMenuText()
{
return ability->getMenuText();
}
@@ -5116,7 +5123,7 @@ int ABlink::resolve()
{
return 0;
}
const char * ABlink::getMenuText()
const string ABlink::getMenuText()
{
return "Blink";
}
@@ -5147,7 +5154,7 @@ int ABlinkGeneric::resolve()
return 1;
}
const char * ABlinkGeneric::getMenuText()
const string ABlinkGeneric::getMenuText()
{
return "Blink";
}
@@ -5316,6 +5323,7 @@ int AEquip::unequip()
{
MTGAbility * a = currentAbilities[i];
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || dynamic_cast<AAConnect *> (a)
|| dynamic_cast<AANewTarget *> (AbilityFactory::getCoreAbility(a))
|| (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
{
SAFE_DELETE(a);
@@ -5369,7 +5377,7 @@ int AEquip::resolve()
return 1;
}
const char * AEquip::getMenuText()
const string AEquip::getMenuText()
{
if (isAttach)
return "Attach";
@@ -5411,83 +5419,83 @@ AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _sourc
}
void AACastCard::Update(float dt)
void AACastCard::Update(float dt)
{
MTGAbility::Update(dt);
if (processed)
return;
if(cardNamed.size() && !theNamedCard)
{
theNamedCard = makeCard();
}
if (restricted)
{
MTGAbility::Update(dt);
if (processed)
return;
if(cardNamed.size() && !theNamedCard)
{
theNamedCard = makeCard();
}
if (restricted)
{
MTGCardInstance * toCheck = (MTGCardInstance*)target;
if(theNamedCard)
toCheck = theNamedCard;
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(toCheck, source->controller()->game->stack) == PlayRestriction::CANT_PLAY)
{
processed = true;
this->forceDestroy = 1;
return ;
}
if(!allowedToCast(toCheck,source->controller()))
{
processed = true;
this->forceDestroy = 1;
return;
}
if(!toCheck->hasType(Subtypes::TYPE_INSTANT) && !(game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
{
processed = true;
this->forceDestroy = 1;
return;
}
}
MTGCardInstance * toCheck = (MTGCardInstance*)target;
if(theNamedCard)
toCheck = theNamedCard;
if (Spell * checkSpell = dynamic_cast<Spell*>(target))
if (game->currentActionPlayer->game->playRestrictions->canPutIntoZone(toCheck, source->controller()->game->stack) == PlayRestriction::CANT_PLAY)
{
toCheck = checkSpell->source;
processed = true;
this->forceDestroy = 1;
return ;
}
if (!game->targetListIsSet(toCheck))
if(!allowedToCast(toCheck,source->controller()))
{
if(game->targetChooser)
game->targetChooser->Owner = source->controller();//sources controller is the caster
processed = true;
this->forceDestroy = 1;
return;
}
resolveSpell();
this->forceDestroy = 1;
if(!toCheck->hasType(Subtypes::TYPE_INSTANT) && !(game->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN || game->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN))
{
processed = true;
this->forceDestroy = 1;
return;
}
}
MTGCardInstance * toCheck = (MTGCardInstance*)target;
if(theNamedCard)
toCheck = theNamedCard;
if (Spell * checkSpell = dynamic_cast<Spell*>(target))
{
toCheck = checkSpell->source;
}
if (!game->targetListIsSet(toCheck))
{
if(game->targetChooser)
game->targetChooser->Owner = source->controller();//sources controller is the caster
return;
}
int AACastCard::isReactingToTargetClick(Targetable * card){return 0;}
int AACastCard::reactToTargetClick(Targetable * object)
{
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
return reactToClick(cObject);
resolveSpell();
this->forceDestroy = 1;
return;
}
int AACastCard::isReactingToTargetClick(Targetable * card){return 0;}
int AACastCard::reactToTargetClick(Targetable * object)
{
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
return reactToClick(cObject);
if (waitingForAnswer)
if (waitingForAnswer)
{
if (tc->toggleTarget(object) == TARGET_OK_FULL)
{
if (tc->toggleTarget(object) == TARGET_OK_FULL)
{
waitingForAnswer = 0;
game->mLayers->actionLayer()->setCurrentWaitingAction(NULL);
return MTGAbility::reactToClick(source);
}
return 1;
waitingForAnswer = 0;
game->mLayers->actionLayer()->setCurrentWaitingAction(NULL);
return MTGAbility::reactToClick(source);
}
return 0;
return 1;
}
return 0;
}
MTGCardInstance * AACastCard::makeCard()
{
MTGCardInstance * card = NULL;
MTGCard * cardData = MTGCollection()->getCardByName(cardNamed);
card = NEW MTGCardInstance(cardData, source->controller()->game);
source->controller()->game->temp->addCard(card);
return card;
}
MTGCardInstance * AACastCard::makeCard()
{
MTGCardInstance * card = NULL;
MTGCard * cardData = MTGCollection()->getCardByName(cardNamed);
card = NEW MTGCardInstance(cardData, source->controller()->game);
source->controller()->game->temp->addCard(card);
return card;
}
int AACastCard::resolveSpell()
{
@@ -5583,7 +5591,7 @@ int AACastCard::resolveSpell()
return 0;
}
const char * AACastCard::getMenuText()
const string AACastCard::getMenuText()
{
if(nameThis.size())
return nameThis.c_str();

View File

@@ -17,6 +17,7 @@
#include "Counters.h"
#include "ModRules.h"
#include "CardDescriptor.h"
#include "GameApp.h"
const float CardGui::Width = 28.0;
const float CardGui::Height = 40.0;
@@ -110,17 +111,17 @@ void CardGui::Update(float dt)
PlayGuiObject::Update(dt);
}
void CardGui::DrawCard(const Pos& inPosition, int inMode)
void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb)
{
DrawCard(card, inPosition, inMode);
DrawCard(card, inPosition, inMode, thumb);
}
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode)
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb)
{
switch (inMode)
{
case DrawMode::kNormal:
RenderBig(inCard, inPosition);
RenderBig(inCard, inPosition, thumb);
break;
case DrawMode::kText:
AlternateRender(inCard, inPosition);
@@ -957,7 +958,7 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad)
}
//Renders a big card on screen. Defaults to the "alternate" rendering if no image is found
void CardGui::RenderBig(MTGCard* card, const Pos& pos)
void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb)
{
JRenderer * renderer = JRenderer::GetInstance();
//GameObserver * game = GameObserver::GetInstance();
@@ -966,7 +967,8 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos)
//i want this but ai targets cards so quickly that it can crash the game.
float x = pos.actX;
JQuadPtr quad = WResourceManager::Instance()->RetrieveCard(card);
JQuadPtr quad = thumb ? WResourceManager::Instance()->RetrieveCard(card, RETRIEVE_THUMB)
: WResourceManager::Instance()->RetrieveCard(card);
MTGCardInstance * kcard = dynamic_cast<MTGCardInstance*>(card);
if(kcard && !kcard->isToken && kcard->name != kcard->model->data->name)
{

View File

@@ -6,6 +6,7 @@
#include "MTGDeck.h"
#include "Subtypes.h"
#include "Translate.h"
#include "GameApp.h"
using std::string;
@@ -84,6 +85,9 @@ int CardPrimitive::init()
alias = 0;
restrictions = NULL;
dredgeAmount = 0;
power = 0;
toughness = 0;
return 1;
}
@@ -225,6 +229,9 @@ void CardPrimitive::setSubtype(const string& value)
}
}
// "Artifact Creature" should have "Creature" as parent type
if (parentType == Subtypes::TYPE_ARTIFACT && isCreature())
parentType = Subtypes::TYPE_CREATURE;
int id = MTGAllCards::add(value, parentType);
addType(id);
@@ -344,18 +351,12 @@ bool CardPrimitive::hasSubtype(int _subtype)
return hasType(_subtype);
}
bool CardPrimitive::hasType(const char * _type)
bool CardPrimitive::hasType(const string& _type)
{
int id = MTGAllCards::findType(_type);
return hasType(id);
}
bool CardPrimitive::hasSubtype(const char * _subtype)
{
int id = MTGAllCards::findType(_subtype);
return hasType(id);
}
bool CardPrimitive::hasSubtype(const string& _subtype)
{
int id = MTGAllCards::findType(_subtype);

View File

@@ -66,7 +66,7 @@ CardSelector::SelectorMemory::SelectorMemory()
}
CardSelector::CardSelector(GameObserver *observer, DuelLayers* duel) :
CardSelectorBase(observer), active(NULL), duel(duel), limitor(NULL), bigpos(300, 145, 1.0, 0.0, 220)
CardSelectorBase(observer), active(NULL), duel(duel), limitor(NULL), bigpos(300, 145, 1.0, 0.0, 220), timer(0.0f)
{
}

View File

@@ -0,0 +1,200 @@
#include "CarouselDeckView.h"
const float CarouselDeckView::max_scale = 0.96f;
const float CarouselDeckView::x_center = 180;
const float CarouselDeckView::right_border = SCREEN_WIDTH + 180;
const float CarouselDeckView::slide_animation_duration = 0.6f;
const float CarouselDeckView::scroll_animation_duration = 0.3f;
CarouselDeckView::CarouselDeckView() :
DeckView(10), mScrollOffset(0), mSlideOffset(0), mScrollEasing(mScrollOffset), mSlideEasing(mSlideOffset)
{
}
CarouselDeckView::~CarouselDeckView()
{}
void CarouselDeckView::UpdateViewState(float dt)
{
if(!mScrollEasing.finished())
{
mScrollEasing.update(dt);
if(mScrollOffset <= -1.0f)
{
changePosition(-1);
mScrollEasing.translate(1.0f);
}
else if(mScrollOffset >= 1.0f)
{
changePosition(1);
mScrollEasing.translate(-1.0f);
}
dirtyCardPos = true;
}
if(!mSlideEasing.finished())
{
mSlideEasing.update(dt);
if(mSlideOffset < mSlideEasing.start_value)
{
//going downwards
if(mSlideOffset < -1.0f)
{
mSlideEasing.translate(2.0f);
changeFilter(1);
}
}
else if(mSlideOffset > mSlideEasing.start_value)
{
//upwards
if(mSlideOffset > 1.0f)
{
mSlideEasing.translate(-2.0f);
changeFilter(-1);
}
}
dirtyCardPos = true;
}
}
void CarouselDeckView::UpdateCardPosition(int index)
{
CardRep &rep = mCards[index];
float rotation = mScrollOffset + 8 - index;
rep.x = x_center + cos((rotation) * M_PI / 12) * (right_border - x_center);
rep.scale = max_scale / 1.12f * cos((rep.x - x_center) * 1.5f / (right_border - x_center)) + 0.2f * max_scale * cos(
cos((rep.x - x_center) * 0.15f / (right_border - x_center)));
rep.y = (SCREEN_HEIGHT_F) / 2.0f + SCREEN_HEIGHT_F * mSlideOffset * (rep.scale + 0.2f);
}
void CarouselDeckView::Reset()
{
mSlideEasing.finish();
mScrollEasing.finish();
DeckView::Reset();
}
void CarouselDeckView::Render()
{
// even though we want to draw the cards in a particular z order for layering, we want to prefetch them
// in a different order, ie the center card should appear first, then the adjacent ones
if (WResourceManager::Instance()->IsThreaded())
{
WResourceManager::Instance()->RetrieveCard(mCards[0].card);
WResourceManager::Instance()->RetrieveCard(mCards[3].card);
WResourceManager::Instance()->RetrieveCard(mCards[4].card);
WResourceManager::Instance()->RetrieveCard(mCards[2].card);
WResourceManager::Instance()->RetrieveCard(mCards[5].card);
WResourceManager::Instance()->RetrieveCard(mCards[1].card);
WResourceManager::Instance()->RetrieveCard(mCards[6].card);
}
renderCard(6);
renderCard(5);
renderCard(4);
renderCard(0);
if (mScrollOffset < 0.5 && mScrollOffset > -0.5)
{
renderCard(1);
renderCard(3);
renderCard(2);
}
else if (mScrollOffset < -0.5)
{
renderCard(3);
renderCard(2);
renderCard(1);
}
else
{
renderCard(1);
renderCard(2);
renderCard(3);
}
}
bool CarouselDeckView::ButtonPressed(Buttons button)
{
switch(button)
{
case JGE_BTN_LEFT:
changePositionAnimated(-1);
last_user_activity = 0;
break;
case JGE_BTN_RIGHT:
changePositionAnimated(1);
last_user_activity = 0;
break;
case JGE_BTN_UP:
changeFilterAnimated(1);
last_user_activity = 0;
break;
case JGE_BTN_DOWN:
changeFilterAnimated(-1);
last_user_activity = 0;
break;
default:
return false;
}
return true;
}
MTGCard * CarouselDeckView::Click(int x, int y)
{
int n = getCardIndexNextTo(x, y);
last_user_activity = 0;
//clicked active card, and no animation is running
if(mSlideEasing.finished() && mScrollEasing.finished())
{
if(n == 2)
{
return getActiveCard();
}
else
{
changePositionAnimated(n - 2);
}
}
return NULL;
}
MTGCard *CarouselDeckView::Click()
{
if(mSlideEasing.finished() && mScrollEasing.finished())
{
return getActiveCard();
}
else
{
return NULL;
}
}
void CarouselDeckView::changePositionAnimated(int offset)
{
if(mScrollEasing.finished())
mScrollEasing.start((float)offset, (float)(scroll_animation_duration * abs(offset)));
last_user_activity = 0;
}
void CarouselDeckView::changeFilterAnimated(int offset)
{
if(mSlideEasing.finished())
mSlideEasing.start(2.0f * float(offset), float(slide_animation_duration * abs(offset)));
last_user_activity = 0;
}
MTGCard *CarouselDeckView::getActiveCard()
{
return mCards[2].card;
}

View File

@@ -7,7 +7,7 @@
#include <iomanip>
#include "Translate.h"
DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const char * _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats) :
DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const string& _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats) :
DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats)
{
backgroundName = "DeckEditorMenuBackdrop";

View File

@@ -370,7 +370,7 @@ void DeckMenu::Update(float dt)
}
void DeckMenu::Add(int id, const char * text, string desc, bool forceFocus, DeckMetaData * deckMetaData)
void DeckMenu::Add(int id, const string& text, const string& desc, bool forceFocus, DeckMetaData * deckMetaData)
{
DeckMenuItem * menuItem = NEW DeckMenuItem(this, id, fontId, text, 0,
mY + DeckMenuConst::kVerticalMargin + mCount * DeckMenuConst::kLineHeight, (mCount == 0), mAutoTranslate, deckMetaData);

View File

@@ -287,8 +287,8 @@ void StatsWrapper::initValues()
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(noLandsProbInTurn, (int)0.0f, sizeof(float) * Constants::STATS_FOR_TURNS);
memset(noCreaturesProbInTurn, (int)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));
@@ -587,7 +587,7 @@ void StatsWrapper::updateStats(DeckDataWrapper *myDeck)
// This should probably be cached in DeckDataWrapper
// or at least be calculated for all common types in one go
int StatsWrapper::countCardsByType(const char * _type, DeckDataWrapper * myDeck)
int StatsWrapper::countCardsByType(const string& _type, DeckDataWrapper * myDeck)
{
int result = 0;
for (int i = 0; i < myDeck->Size(true); i++)

View File

@@ -0,0 +1,213 @@
#include "DeckView.h"
#include "GameOptions.h"
#include "CardGui.h"
const float DeckView::no_user_activity_show_card_delay = 0.1f;
DeckView::DeckView(int numberOfCards)
: dirtyFilters(true), dirtyCardPos(true), last_user_activity(0.0f), mFilter(0), mCurrentDeck(NULL)
{
mCards.resize(numberOfCards);
}
DeckView::~DeckView()
{
}
void DeckView::Reset()
{
dirtyFilters = true;
dirtyCardPos = true;
last_user_activity = 0;
mFilter = 0;
mCurrentDeck = NULL;
}
void DeckView::Update(float dt)
{
last_user_activity += dt;
UpdateViewState(dt);
if(dirtyCardPos)
{
for(unsigned int i = 0; i < mCards.size(); ++i)
{
UpdateCardPosition(i);
}
dirtyCardPos = false;
}
}
void DeckView::SetDeck(DeckDataWrapper *toShow)
{
mCurrentDeck = toShow;
dirtyCardPos = true;
dirtyFilters = true;
reloadIndexes();
}
DeckDataWrapper* DeckView::deck()
{
return mCurrentDeck;
}
void DeckView::changeFilter(int delta)
{
unsigned int FilterCount = Constants::NB_Colors + 1;
mFilter = (FilterCount + mFilter + delta) % FilterCount;
dirtyFilters = true;
}
void DeckView::changePosition(int delta)
{
for(int i = 0; i < delta; ++i)
{
mCurrentDeck->next();
}
for(int i = 0; i > delta; --i)
{
mCurrentDeck->prev();
}
reloadIndexes();
}
int DeckView::filter()
{
return mFilter;
}
void DeckView::reloadIndexes()
{
if(mCurrentDeck != NULL)
{
for (unsigned int i = 0; i < mCards.size(); i++)
{
mCards[i].card = deck()->getCard(i);
}
}
}
void DeckView::renderCard(int index, int alpha, bool asThumbnail)
{
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
const CardRep& cardPosition = mCards[index];
if (!cardPosition.card) return;
if (!WResourceManager::Instance()->IsThreaded())
{
JQuadPtr backQuad = WResourceManager::Instance()->GetQuad(kGenericCardID);
JQuadPtr quad;
int cacheError = CACHE_ERROR_NONE;
if (!options[Options::DISABLECARDS].number)
{
quad = WResourceManager::Instance()->RetrieveCard(cardPosition.card, RETRIEVE_EXISTING);
cacheError = WResourceManager::Instance()->RetrieveError();
if (!quad.get() && cacheError != CACHE_ERROR_404)
{
if (last_user_activity > (abs(2 - index) + 1) * no_user_activity_show_card_delay)
quad = WResourceManager::Instance()->RetrieveCard(cardPosition.card);
else
{
quad = backQuad;
}
}
}
if (quad.get())
{
if (quad == backQuad)
{
quad->SetColor(ARGB(255,255,255,255));
float _scale = cardPosition.scale * (285 / quad->mHeight);
JRenderer::GetInstance()->RenderQuad(quad.get(), cardPosition.x, cardPosition.y, 0.0f, _scale, _scale);
}
else
{
Pos pos = Pos(cardPosition.x, cardPosition.y, cardPosition.scale * 285 / 250, 0.0, 255);
CardGui::DrawCard(cardPosition.card, pos, asThumbnail);
}
}
else
{
Pos pos = Pos(cardPosition.x, cardPosition.y, cardPosition.scale * 285 / 250, 0.0, 255);
CardGui::DrawCard(cardPosition.card, pos, DrawMode::kText, asThumbnail);
}
}
else
{
int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText;
Pos pos = Pos(cardPosition.x, cardPosition.y, cardPosition.scale * 285 / 250, 0.0, 255);
CardGui::DrawCard(cardPosition.card, pos, mode, asThumbnail);
}
int quadAlpha = alpha;
if (!deck()->count(cardPosition.card)) quadAlpha /= 2;
quadAlpha = 255 - quadAlpha;
if (quadAlpha > 0)
{
JRenderer::GetInstance()->FillRect(cardPosition.x - cardPosition.scale * 100.0f, cardPosition.y - cardPosition.scale * 142.5f, cardPosition.scale * 200.0f, cardPosition.scale * 285.0f,
ARGB(quadAlpha,0,0,0));
}
if (last_user_activity < 3)
{
int fontAlpha = alpha;
float qtY = cardPosition.y - 135 * cardPosition.scale;
float qtX = cardPosition.x + 40 * cardPosition.scale;
char buffer[4096];
sprintf(buffer, "x%i", deck()->count(cardPosition.card));
WFont * font = mFont;
font->SetColor(ARGB(fontAlpha/2,0,0,0));
JRenderer::GetInstance()->FillRect(qtX, qtY, font->GetStringWidth(buffer) + 6, 16, ARGB(fontAlpha/2,0,0,0));
font->DrawString(buffer, qtX + 4, qtY + 4);
font->SetColor(ARGB(fontAlpha,255,255,255));
font->DrawString(buffer, qtX + 2, qtY + 2);
font->SetColor(ARGB(255,255,255,255));
}
}
int DeckView::getCardIndexNextTo(int x, int y)
{
int bestCardIndex = -1;
float bestDistance = 0;
for(unsigned int i = 0; i < mCards.size(); i++)
{
const CardRep& cardPosition = mCards[i];
float dx = (x - cardPosition.x);
float dy = (y - cardPosition.y);
float dist = dx*dx + dy*dy;
if(dist < bestDistance || bestCardIndex == -1)
{
bestDistance = dist;
bestCardIndex = i;
}
}
return bestCardIndex;
}
int DeckView::getPosition()
{
if(!mCurrentDeck)
{
return 0;
}
int total = mCurrentDeck->Size();
int currentPos = (mCurrentDeck->getOffset() + 3) % total;
while (currentPos <= 0) currentPos += total;
return currentPos;
}

View File

@@ -110,12 +110,12 @@ GamePhase GameObserver::getCurrentGamePhase()
return mCurrentGamePhase;
}
const char* GameObserver::getCurrentGamePhaseName()
const string& GameObserver::getCurrentGamePhaseName()
{
return phaseRing->phaseName(mCurrentGamePhase);
}
const char* GameObserver::getNextGamePhaseName()
const string& GameObserver::getNextGamePhaseName()
{
return phaseRing->phaseName((mCurrentGamePhase + 1) % MTG_PHASE_CLEANUP);
}
@@ -1042,7 +1042,7 @@ void GameObserver::Affinity()
}
else
{
reduce = card->controller()->game->battlefield->countByType(type.c_str());
reduce = card->controller()->game->battlefield->countByType(type);
}
for(int i = 0; i < reduce;i++)
{

View File

@@ -818,9 +818,9 @@ void GameSettings::createUsersFirstDeck(int setId)
mCollection->addRandomCards(10, 0, 0, Constants::RARITY_L, "Island");
//Starter Deck
mCollection->addRandomCards(3, sets, 1, Constants::RARITY_R, NULL);
mCollection->addRandomCards(9, sets, 1, Constants::RARITY_U, NULL);
mCollection->addRandomCards(48, sets, 1, Constants::RARITY_C, NULL);
mCollection->addRandomCards(3, sets, 1, Constants::RARITY_R);
mCollection->addRandomCards(9, sets, 1, Constants::RARITY_U);
mCollection->addRandomCards(48, sets, 1, Constants::RARITY_C);
//Boosters
for (int i = 0; i < 2; i++)
@@ -956,7 +956,7 @@ OptionMaxGrade::OptionMaxGrade()
// MARK: OptionASkipPhase
OptionASkipPhase OptionASkipPhase::mDef;
OptionASkipPhase OptionASkipPhase::mDef = OptionASkipPhase();
OptionASkipPhase::OptionASkipPhase()
{
mDef.values.push_back(EnumDefinition::assoc(Constants::ASKIP_NONE, "Off"));

View File

@@ -134,7 +134,7 @@ void GameState::renderDeckMenu(DeckMenu * _menu, const vector<DeckMetaData *>& d
// deck sorting routines
bool sortByName(DeckMetaData * d1, DeckMetaData * d2)
{
return strcmp(d1->getName().c_str(), d2->getName().c_str()) < 0;
return d1->getName() < d2->getName();
}

File diff suppressed because it is too large Load Diff

View File

@@ -14,6 +14,7 @@
#include "Translate.h"
#include "Rules.h"
#include "ModRules.h"
#include "GameApp.h"
#ifdef TESTSUITE
#include "TestSuiteAI.h"

View File

@@ -79,7 +79,7 @@ GameStateShop::GameStateShop(GameApp* parent) :
kCreditsString = _(kCreditsString);
cycleCardsButton = NEW InteractiveButton(NULL, kCycleCardsButtonId, Fonts::MAIN_FONT, "New Cards", SCREEN_WIDTH_F - 80, SCREEN_HEIGHT_F - 20, JGE_BTN_PRI);
showCardListButton = NEW InteractiveButton(NULL, kShowCardListButtonId, Fonts::MAIN_FONT, "Show List", SCREEN_WIDTH_F - 150, SCREEN_HEIGHT_F - 20, JGE_BTN_SEC);
disablePurchase = false;
clearInput = false;
@@ -102,7 +102,6 @@ void GameStateShop::Start()
bListCards = false;
mTouched = false;
mStage = STAGE_FADE_IN;
mElapsed = 0;
needLoad = true;
booster = NULL;
srcCards = NEW WSrcUnlockedCards(0);
@@ -259,8 +258,8 @@ void GameStateShop::cancelCard(int controlId)
break;
}
price = price - (rnd * price) / 100;
if (price < pricelist->getPrice(c->getMTGId())) //filters have a tendancy to increase the price instead of lowering it!
pricelist->setPrice(c->getMTGId(), price);
if (price < pricelist->getPrice(c)) //filters have a tendancy to increase the price instead of lowering it!
pricelist->setPrice(c, price);
//Prices do not immediately go down when you ignore something.
return;
}
@@ -427,7 +426,7 @@ void GameStateShop::End()
{
save();
JRenderer::GetInstance()->EnableVSync(false);
mElapsed = 0;
SAFE_DELETE(shopMenu);
SAFE_DELETE(bigDisplay);
SAFE_DELETE(srcCards);
@@ -469,9 +468,6 @@ void GameStateShop::Update(float dt)
if (lightAlpha > 50)
lightAlpha = 50;
if (mStage != STAGE_FADE_IN)
mElapsed += dt;
JButton btn;
switch (mStage)
{
@@ -496,7 +492,7 @@ void GameStateShop::Update(float dt)
}
break;
case STAGE_SHOP_TASKS:
if (menu)
if (menu && !menu->isClosed())
{
menu->Update(dt);
return;
@@ -768,21 +764,17 @@ void GameStateShop::Render()
r->FillRect(0, SCREEN_HEIGHT - 17, SCREEN_WIDTH, 17, ARGB(128,0,0,0));
std::ostringstream stream;
stream << kCreditsString << playerdata->credits;
mFont->SetColor(ARGB(255,255,255,255));
mFont->DrawString(stream.str(), 5, SCREEN_HEIGHT - 14);
#ifndef TOUCH_ENABLED
float len = 4 + mFont->GetStringWidth(kOtherCardsString.c_str());
r->RenderQuad(pspIcons[6].get(), SCREEN_WIDTH - len - 0.5 - 10, SCREEN_HEIGHT - 8, 0, kPspIconScaleFactor, kPspIconScaleFactor);
mFont->DrawString(kOtherCardsString, SCREEN_WIDTH - len, SCREEN_HEIGHT - 14);
#else
#ifdef IOS
mFont->SetScale(1.2f); // for iOS devices.
#endif
enableButtons();
#endif
mFont->SetColor(ARGB(255,255,255,255));
mFont->DrawString(stream.str(), 5, SCREEN_HEIGHT - 14);
mFont->SetColor(ARGB(255,255,255,0));
mFont->DrawString(descPurchase(bigSync.getPos()).c_str(), SCREEN_WIDTH / 2, SCREEN_HEIGHT - 14, JGETEXT_CENTER);
mFont->SetColor(ARGB(255,255,255,255));

View File

@@ -65,7 +65,7 @@ void GameStateStory::Update(float dt)
if (!menu && mEngine->GetButtonClick(JGE_BTN_MENU))
{
menu = NEW SimpleMenu(JGE::GetInstance(), WResourceManager::Instance(), 100, this, Fonts::MENU_FONT, SCREEN_WIDTH / 2 - 100, 25);
menu->Add(0, "Back to main menu");
menu->Add(0, string("Back to main menu"));
menu->Add(kCancelMenuID, "Cancel");
}
if (menu)

View File

@@ -0,0 +1,284 @@
#include "GridDeckView.h"
const float GridDeckView::scroll_animation_duration = 0.3f;
const float GridDeckView::slide_animation_duration = 0.6f;
const float GridDeckView::card_scale_small = 0.48f;
const float GridDeckView::card_scale_big = 0.7f;
GridDeckView::GridDeckView()
: DeckView(16), mCols(8), mRows(2), mScrollOffset(0), mSlideOffset(0),
mScrollEasing(mScrollOffset), mSlideEasing(mSlideOffset), mCurrentSelection(-1),
mButtonMode(false)
{
}
GridDeckView::~GridDeckView()
{
}
void GridDeckView::Reset()
{
mSlideEasing.finish();
mScrollEasing.finish();
mCurrentSelection = 0;
mButtonMode = false;
DeckView::Reset();
}
void GridDeckView::UpdateViewState(float dt)
{
if(!mScrollEasing.finished())
{
mScrollEasing.update(dt);
if(mScrollOffset <= -1.0f)
{
changePosition(2);
moveSelection(-2, false);
mScrollEasing.translate(1.0f);
}
else if(mScrollOffset >= 1.0f)
{
changePosition(-2);
moveSelection(2, false);
mScrollEasing.translate(-1.0f);
}
dirtyCardPos = true;
}
if(!mSlideEasing.finished())
{
mSlideEasing.update(dt);
if(mSlideOffset < -1.0f)
{
mSlideEasing.translate(2.0f);
changeFilter(1);
}
else if(mSlideOffset > 1.0f)
{
mSlideEasing.translate(-2.0f);
changeFilter(-1);
}
dirtyCardPos = true;
}
}
void GridDeckView::UpdateCardPosition(int index)
{
CardRep &rep = mCards[index];
int col = index / mRows;
int row = index % mRows;
float colWidth = SCREEN_WIDTH_F / (mCols - 3);
float rowHeight = SCREEN_HEIGHT_F / mRows;
rep.x = (col + mScrollOffset) * colWidth - colWidth;
rep.y = row * rowHeight + mSlideOffset*SCREEN_HEIGHT + rowHeight/2;
if(mCurrentSelection == index)
{
rep.scale = card_scale_big;
if(row == 0)
{
rep.y += rowHeight * (card_scale_big - card_scale_small);
}
else
{
rep.y -= rowHeight * (card_scale_big - card_scale_small);
}
}
else
{
rep.scale = card_scale_small;
}
}
void GridDeckView::Render()
{
int firstVisibleCard = 2;
int lastVisibleCard = mCards.size() - 2;
if(!mScrollEasing.finished())
{
if(mScrollEasing.delta_value > 0){
firstVisibleCard = 0;
}
else
{
lastVisibleCard = mCards.size();
}
}
for(int i = firstVisibleCard; i < lastVisibleCard; ++i)
{
if(mCurrentSelection != i)
{
if (WResourceManager::Instance()->IsThreaded())
{
WResourceManager::Instance()->RetrieveCard(mCards[i].card, RETRIEVE_THUMB);
}
renderCard(i, 255, true);
}
else
{
if (WResourceManager::Instance()->IsThreaded())
{
WResourceManager::Instance()->RetrieveCard(mCards[i].card);
}
}
}
if(2 <= mCurrentSelection && mCurrentSelection < 12)
{
renderCard(mCurrentSelection, 255, false);
}
}
bool GridDeckView::ButtonPressed(Buttons button)
{
switch(button)
{
case JGE_BTN_LEFT:
if(mButtonMode && mScrollEasing.finished()) moveSelection(-2, true);
else if(!mButtonMode) changePositionAnimated(-1);
last_user_activity = 0;
break;
case JGE_BTN_RIGHT:
if(mButtonMode && mScrollEasing.finished()) moveSelection(2, true);
else if(!mButtonMode) changePositionAnimated(1);
last_user_activity = 0;
break;
case JGE_BTN_UP:
if(mButtonMode && mScrollEasing.finished()) moveSelection(-1, true);
else if(!mButtonMode) changeFilterAnimated(1);
last_user_activity = 0;
break;
case JGE_BTN_DOWN:
if(mButtonMode && mScrollEasing.finished()) moveSelection(1, true);
else if(!mButtonMode) changeFilterAnimated(-1);
last_user_activity = 0;
break;
case JGE_BTN_CTRL:
if(mButtonMode)
{
mButtonMode = false;
dirtyCardPos = true;
mCurrentSelection = -1;
}
else return false;
break;
default:
return false;
}
return true;
}
MTGCard * GridDeckView::Click(int x, int y)
{
int n = getCardIndexNextTo(x, y);
last_user_activity = 0;
mButtonMode = false;
if(mScrollEasing.finished() && mSlideEasing.finished())
{ //clicked and no animations running
if(n == mCurrentSelection)
{
return getActiveCard();
}
else if(n < 4)
{
changePositionAnimated(-1);
}
else if(n >= 12)
{
changePositionAnimated(1);
}
else
{
mCurrentSelection = n;
dirtyCardPos = true;
}
}
return NULL;
}
MTGCard * GridDeckView::Click()
{
if(mScrollEasing.finished() && mSlideEasing.finished())
{
MTGCard *active = getActiveCard();
if(active != NULL)
{
return active;
}
else
{
mButtonMode = true;
dirtyCardPos = true;
mCurrentSelection = 4;
}
}
return NULL;
}
void GridDeckView::changePositionAnimated(int offset)
{
if(mScrollEasing.finished())
mScrollEasing.start(-1.0f * offset, scroll_animation_duration * abs(offset));
last_user_activity = 0;
}
void GridDeckView::changeFilterAnimated(int offset)
{
if(mSlideEasing.finished())
mSlideEasing.start(2.0f * offset, float(slide_animation_duration * abs(offset)));
last_user_activity = 0;
}
MTGCard* GridDeckView::getActiveCard()
{
if(mCurrentSelection >= 4 && mCurrentSelection < int(mCards.size())-4)
{
return mCards[mCurrentSelection].card;
}
else
{
return NULL;
}
}
void GridDeckView::moveSelection(int offset, bool alignIfOutOfBounds)
{
mCurrentSelection += offset;
if(alignIfOutOfBounds)
{
if(mCurrentSelection < 4)
{
changePositionAnimated(-1);
}
else if(mCurrentSelection >= 12)
{
changePositionAnimated(1);
}
}
else
{
if(mCurrentSelection < 4 || mCurrentSelection >= 12)
{
mCurrentSelection = -1;
}
}
dirtyCardPos = true;
}

View File

@@ -3,6 +3,7 @@
#include "GuiMana.h"
#include "OptionItem.h"
#include "Player.h"
#include "GameApp.h"
//using std::cout;
using std::endl;

View File

@@ -24,26 +24,28 @@
};
*/
const float GuiPhaseBar::zoom_big = (float)(1.5 * 1.4);
const float GuiPhaseBar::zoom_small = 1.5;
const float GuiPhaseBar::step = M_PI/6.0f;
namespace
{
//width and height of the phase symbol textures
const float kWidth = 28;
const float kHeight = kWidth;
const unsigned kPhases = 12;
const unsigned kPhases = NB_MTG_PHASES - 2; //there are two phases we do not show
}
const float ICONSCALE = 1.5;
const float CENTER = SCREEN_HEIGHT_F / 2 + 10;
void DrawGlyph(JQuad* inQuad, int inGlyph, float inY, float, unsigned int inP, float inScale)
{
float xPos = static_cast<float> ((inP + inGlyph * (int) (kWidth + 1)) % (kPhases * (int) (kWidth + 1)));
inQuad->SetTextureRect(xPos, 0, kWidth, kHeight);
JRenderer::GetInstance()->RenderQuad(inQuad, 0, inY, 0.0, inScale, inScale);
}
void GuiPhaseBar::DrawGlyph(JQuad *inQuad, int phaseId, float x, float y, float scale)
{
inQuad->SetTextureRect(phaseId * (kWidth + 1), 0, kWidth, kHeight);
JRenderer::GetInstance()->RenderQuad(inQuad, x, y - scale * kWidth/2, 0.0f, scale, scale);
}
GuiPhaseBar::GuiPhaseBar(DuelLayers* duelLayers) :
GuiLayer(duelLayers->getObserver()), PlayGuiObject(0, 0, 106, 0, false),
phase(NULL), angle(0.0f), zoomFactor(ICONSCALE), mpDuelLayers(duelLayers)
GuiLayer(duelLayers->getObserver()), PlayGuiObject(80, 0, 106, 0, false),
displayedPhaseId(0), angle(0.0f), zoomFactor(zoom_small), angleEasing(angle),
zoomFactorEasing(zoomFactor), mpDuelLayers(duelLayers)
{
if(duelLayers->getObserver()->getResourceManager())
{
@@ -57,10 +59,7 @@ GuiPhaseBar::GuiPhaseBar(DuelLayers* duelLayers) :
GameApp::systemError = "Error loading phasebar texture : " __FILE__;
}
zoom = ICONSCALE;
mpDuelLayers->getCardSelector()->Add(this);
}
GuiPhaseBar::~GuiPhaseBar()
@@ -69,32 +68,27 @@ GuiPhaseBar::~GuiPhaseBar()
void GuiPhaseBar::Update(float dt)
{
if (angle > 3 * dt)
angle -= 3 * dt;
else
angle = 0;
angleEasing.update(dt);
if (dt > 0.05f) dt = 0.05f;
if(zoomFactor + 0.05f < zoom)
if(angle <= -step)
{
zoomFactor += dt;
}
else if (zoomFactor - 0.05f > zoom)
{
zoomFactor -= dt;
displayedPhaseId = (displayedPhaseId + 1) % kPhases;
angleEasing.translate(step);
}
zoomFactorEasing.update(dt);
}
void GuiPhaseBar::Entering()
{
mHasFocus = true;
zoom = 1.4f*ICONSCALE;
zoomFactorEasing.start(zoom_big, 0.3f);
}
bool GuiPhaseBar::Leaving(JButton)
{
mHasFocus = false;
zoom = ICONSCALE;
zoomFactorEasing.start(zoom_small, 0.6f);
return true;
}
@@ -102,41 +96,28 @@ void GuiPhaseBar::Render()
{
JQuadPtr quad = WResourceManager::Instance()->GetQuad("phasebar");
//uncomment to draw a hideous line across hires screens.
// JRenderer::GetInstance()->DrawLine(0, CENTER, SCREEN_WIDTH, CENTER, ARGB(255, 255, 255, 255));
// JRenderer::GetInstance()->DrawLine(0, CENTER, SCREEN_WIDTH, CENTER, ARGB(255, 255, 255, 255));
unsigned int p = (phase->id + kPhases - 4) * (int) (kWidth + 1);
float centerYPosition = CENTER + (kWidth / 2) * angle * zoomFactor / (M_PI / 6) - zoomFactor * kWidth / 4;
float yPos = centerYPosition;
float scale = 0;
for (int glyph = 3; glyph < 6; ++glyph)
{
scale = zoomFactor * sinf(angle + glyph * M_PI / 6) / 2;
DrawGlyph(quad.get(), glyph, yPos, angle, p, scale);
yPos += kWidth * scale;
}
const float radius = 25 * zoomFactor;
yPos = centerYPosition;
for (int glyph = 2; glyph > 0; --glyph)
for(int i = 0; i < 6; ++i)
{
scale = zoomFactor * sinf(angle + glyph * M_PI / 6) / 2;
yPos -= kWidth * scale;
DrawGlyph(quad.get(), glyph, yPos, angle, p, scale);
}
//the position of the glyphe in the circle
const float circPos = (i - 2) * step + angle;
const float glyphY = this->y + this->mHeight / 2 + sin(circPos) * radius;
if (angle > 0)
{
scale = zoomFactor * sinf(angle) / 2;
yPos -= kWidth * scale;
float xPos = static_cast<float> (p % (kPhases * (int) (kWidth + 1)));
quad->SetTextureRect(xPos, kHeight, kWidth, kHeight);
JRenderer::GetInstance()->RenderQuad(quad.get(), 0, yPos, 0.0, scale, scale);
//the scale is computed so that the glyphes touch each other
//hint: sin(circPos + PI/2) = cos(circPos)
const float glyphScale = float(zoomFactor * cosf(circPos) * 0.5f);
DrawGlyph(quad.get(), (displayedPhaseId - 2 + i + kPhases) % kPhases, 0, glyphY, glyphScale);
}
//print phase name
WFont * font = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
string currentP = _("your turn");
string interrupt = "";
if (observer->currentPlayer == mpDuelLayers->getRenderedPlayerOpponent())
if (observer->currentPlayer == mpDuelLayers->getRenderedPlayerOpponent())
{
currentP = _("opponent's turn");
}
@@ -147,7 +128,7 @@ void GuiPhaseBar::Render()
}
if (observer->currentlyActing() != observer->currentPlayer)
{
if (observer->currentPlayer == mpDuelLayers->getRenderedPlayer())
if (observer->currentPlayer == mpDuelLayers->getRenderedPlayer())
{
interrupt = _(" - ") + _("opponent plays");
}
@@ -159,7 +140,9 @@ void GuiPhaseBar::Render()
char buf[200];
//running this string through translate returns gibberish even though we defined the variables in the lang.txt
string phaseNameToTranslate = observer->phaseRing->phaseName(phase->id);
//the conversion from phase bar phases to mtg phases is x%kPhases + 1
//todo: just to this when the displayedPhaseId updates
string phaseNameToTranslate = observer->phaseRing->phaseName(displayedPhaseId%kPhases + 1);
phaseNameToTranslate = _(phaseNameToTranslate);
sprintf(buf, _("(%s%s) %s").c_str(), currentP.c_str(), interrupt.c_str(),phaseNameToTranslate.c_str());
font->DrawString(buf, SCREEN_WIDTH - 5, 2, JGETEXT_RIGHT);
@@ -170,8 +153,20 @@ int GuiPhaseBar::receiveEventMinus(WEvent *e)
WEventPhaseChange *event = dynamic_cast<WEventPhaseChange*> (e);
if (event)
{
angle = M_PI / 6;
phase = event->to;
//convert the mtg phase to the phases of the phase wheel
//the mapping is
//0 -> none
//1..12 -> 0..11
//13 -> none
int targetPhase = event->to->id;
if(targetPhase != 0 && targetPhase != 13)
{
targetPhase -= 1;
int phasesToAnimate = (targetPhase - displayedPhaseId + kPhases) % kPhases;
angleEasing.start(float(phasesToAnimate * (- step)), 0.3f * float(sqrt(float(phasesToAnimate))));
}
}
return 1;
}

View File

@@ -1039,6 +1039,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
observer->addObserver(NEW MTGMorphCostRule(observer, -1));
return NULL;
}
found = s.find("playfromgraveyardrule");
if(found != string::npos)
{
observer->addObserver(NEW MTGPlayFromGraveyardRule(observer, -1));
return NULL;
}
//this rule handles attacking ability during attacker phase
found = s.find("attackrule");
if(found != string::npos)
@@ -1145,7 +1151,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
}
if(strncmp(s.c_str(), "chooseacolor ", strlen("chooseacolor ")) == 0 || strncmp(s.c_str(), "chooseatype ", strlen("chooseatype ")) == 0)
if (StartsWith(s, "chooseacolor ") || StartsWith(s, "chooseatype "))
{
MTGAbility * choose = parseChooseActionAbility(s,card,spell,target,0,id);
choose = NEW GenericActivatedAbility(observer, "","",id, card,choose,NULL);
@@ -3272,7 +3278,7 @@ MTGAbility * AbilityFactory::parseChooseActionAbility(string s,MTGCardInstance *
a->canBeInterrupted = false;
return a;
}
//choose a color
//choose a color
vector<string> splitChooseAColor = parseBetween(s, "chooseacolor ", " chooseend");
if (splitChooseAColor.size())
{
@@ -4368,6 +4374,7 @@ MTGAbility::MTGAbility(GameObserver* observer, int id, MTGCardInstance * card) :
aType = MTGAbility::UNKNOWN;
mCost = NULL;
forceDestroy = 0;
forcedAlive = 0;
oneShot = 0;
canBeInterrupted = true;
}
@@ -4381,6 +4388,7 @@ MTGAbility::MTGAbility(GameObserver* observer, int id, MTGCardInstance * _source
aType = MTGAbility::UNKNOWN;
mCost = NULL;
forceDestroy = 0;
forcedAlive = 0;
oneShot = 0;
canBeInterrupted = true;
}
@@ -4893,7 +4901,7 @@ int TargetAbility::resolve()
return 0;
}
const char * TargetAbility::getMenuText()
const string TargetAbility::getMenuText()
{
if (ability)
return ability->getMenuText();
@@ -5423,7 +5431,7 @@ GenericTriggeredAbility::~GenericTriggeredAbility()
SAFE_DELETE(destroyCondition);
}
const char * GenericTriggeredAbility::getMenuText()
const string GenericTriggeredAbility::getMenuText()
{
return ability->getMenuText();
}
@@ -5451,6 +5459,7 @@ AManaProducer::AManaProducer(GameObserver* observer, int id, MTGCardInstance * c
aType = MTGAbility::MANA_PRODUCER;
setCost(_cost);
output = _output;
tap = 0;
Producing = producing;
menutext = "";
DoesntEmpty = doesntEmpty;
@@ -5516,7 +5525,7 @@ int AManaProducer::reactToClick(MTGCardInstance * _card)
return ActivatedAbility::activateAbility();
}
const char * AManaProducer::getMenuText()
const string AManaProducer::getMenuText()
{
if (menutext.size())
return menutext.c_str();

View File

@@ -125,6 +125,7 @@ int MTGCardInstance::init()
void MTGCardInstance::initMTGCI()
{
X = 0;
sample = "";
model = NULL;
isToken = false;
@@ -195,6 +196,8 @@ void MTGCardInstance::initMTGCI()
lastController = NULL;
regenerateTokens = 0;
blocked = false;
graveEffects = false;
exileEffects = false;
currentZone = NULL;
cardsAbilities = vector<MTGAbility *>();
data = this; //an MTGCardInstance point to itself for data, allows to update it without killing the underlying database item
@@ -254,22 +257,22 @@ void MTGCardInstance::addType(int type)
SAFE_DELETE(e);
}
void MTGCardInstance::addType(char * type_text)
void MTGCardInstance::addType(const string& type_text)
{
setSubtype(type_text);
}
void MTGCardInstance::setType(const char * type_text)
void MTGCardInstance::setType(const string& type_text)
{
setSubtype(type_text);
}
void MTGCardInstance::setSubtype(string value)
void MTGCardInstance::setSubtype(const string& value)
{
int id = MTGAllCards::findType(value);
addType(id);
}
int MTGCardInstance::removeType(string value, int removeAll)
int MTGCardInstance::removeType(const string& value, int removeAll)
{
int id = MTGAllCards::findType(value);
return removeType(id, removeAll);

View File

@@ -47,33 +47,33 @@ static inline int getGrade(int v)
int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primitive)
{
if ('#' == s[0]) return 1; // a comment shouldn't be treated as an error condition
size_t i = s.find_first_of('=');
if (i == string::npos || 0 == i)
size_t del_pos = s.find_first_of('=');
if (del_pos == string::npos || 0 == del_pos)
return 0;
char* key = const_cast<char*> (s.c_str()); // I know what I'm doing, let me do it
key[i] = 0;
char* val = key + i + 1;
s[del_pos] = '\0';
const string key = s.substr(0, del_pos);
const string val = s.substr(del_pos + 1);
switch (key[0])
{
case 'a':
if (0 == strcmp("auto", key))
if (key == "auto")
{
if (!primitive) primitive = NEW CardPrimitive();
primitive->addMagicText(val);
}
else if (0 == strncmp("auto", key, 4))
else if (StartsWith(key, "auto"))
{
if (!primitive) primitive = NEW CardPrimitive();
primitive->addMagicText(val, key + 4);
primitive->addMagicText(val, key.substr(4));
}
else if (0 == strcmp("alias", key))
else if (key == "alias")
{
if (!primitive) primitive = NEW CardPrimitive();
primitive->alias = atoi(val);
primitive->alias = atoi(val.c_str());
}
else if (0 == strcmp("abilities", key))
else if (key == "abilities")
{
if (!primitive) primitive = NEW CardPrimitive();
string value = val;
@@ -152,12 +152,12 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
}
case 'g': //grade
if (s.size() - i - 1 > 2) currentGrade = getGrade(val[2]);
if (s.size() - del_pos - 1 > 2) currentGrade = getGrade(val[2]);
break;
case 'i': //id
if (!card) card = NEW MTGCard();
card->setMTGId(atoi(val));
card->setMTGId(atoi(val.c_str()));
break;
case 'k': //kicker
@@ -222,7 +222,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
break;
case 'p':
if ('r' == key[1])
if (key[1] == 'r')
{ // primitive
if (!card) card = NEW MTGCard();
map<string, CardPrimitive*>::iterator it = primitives.find(val);
@@ -231,18 +231,18 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
else
{ //power
if (!primitive) primitive = NEW CardPrimitive();
primitive->setPower(atoi(val));
primitive->setPower(atoi(val.c_str()));
}
break;
case 'r': //retrace/rarity//restrictions
if('s' == key[2] && 't' == key[3])//restrictions
if(key[2] == 's' && key[3] == 't')//restrictions
{
if (!primitive) primitive = NEW CardPrimitive();
string value = val;
primitive->setRestrictions(value);
}
else if ('e' == key[1] && 't' == key[2])
else if (key[1] == 'e' && key[2] == 't')
{ //retrace
if (!primitive) primitive = NEW CardPrimitive();
if (ManaCost * cost = primitive->getManaCost())
@@ -279,7 +279,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
else
{
if (!primitive) primitive = NEW CardPrimitive();
vector<string> values = split(val, ' ');
vector<string> values = split(val.c_str(), ' ');
for (size_t values_i = 0; values_i < values.size(); ++values_i)
primitive->setSubtype(values[values_i]);
}
@@ -288,21 +288,21 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
case 't':
if (!primitive) primitive = NEW CardPrimitive();
if (0 == strcmp("target", key))
if (key == "target")
{
string value = val;
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
primitive->spellTargetType = value;
}
else if (0 == strcmp("text", key))
else if (key == "text")
primitive->setText(val);
else if (0 == strcmp("type", key))
else if (key == "type")
{
vector<string> values = split(val, ' ');
for (size_t values_i = 0; values_i < values.size(); ++values_i)
primitive->setType(values[values_i]);
}
else if (0 == strcmp("toughness", key)) primitive->setToughness(atoi(val));
else if (key == "toughness") primitive->setToughness(atoi(val.c_str()));
break;
default:
@@ -317,7 +317,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
tempPrimitive = primitive;
tempCard = card;
return i;
return del_pos;
}
@@ -381,10 +381,20 @@ void MTGAllCards::loadFolder(const string& infolder, const string& filename )
}
}
int MTGAllCards::load(const char * config_file, const char * set_name, int)
int MTGAllCards::load(const string &config_file)
{
return load(config_file, MTGSets::INTERNAL_SET);
}
int MTGAllCards::load(const string& config_file, const string &set_name)
{
const int set_id = setlist.Add(set_name);
return load(config_file, set_id);
}
int MTGAllCards::load(const string &config_file, int set_id)
{
conf_read_mode = 0;
const int set_id = set_name ? setlist.Add(set_name) : MTGSets::INTERNAL_SET;
MTGSetInfo *si = setlist.getInfo(set_id);
int lineNumber = 0;
@@ -532,14 +542,16 @@ int MTGAllCards::countBySet(int setId)
}
//TODO more efficient way ?
int MTGAllCards::countByType(const char * _type)
int MTGAllCards::countByType(const string &_type)
{
int type_id = findType(_type);
int result = 0;
map<int, MTGCard *>::iterator it;
for (it = collection.begin(); it != collection.end(); it++)
{
MTGCard * c = it->second;
if (c->data->hasType(_type))
if (c->data->hasType(type_id))
{
result++;
}
@@ -772,7 +784,7 @@ int MTGDeck::totalPrice()
return total;
}
MTGDeck::MTGDeck(const char * config_file, MTGAllCards * _allcards, int meta_only,int difficultyRating)
MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_only, int difficultyRating)
{
total_cards = 0;
database = _allcards;
@@ -879,7 +891,7 @@ MTGCard * MTGDeck::getCardById(int mtgId)
return database->getCardById(mtgId);
}
int MTGDeck::addRandomCards(int howmany, int * setIds, int nbSets, int rarity, const char * _subtype, int * colors, int nbcolors)
int MTGDeck::addRandomCards(int howmany, int * setIds, int nbSets, int rarity, const string &_subtype, int * colors, int nbcolors)
{
if (howmany <= 0) return 1;
@@ -900,8 +912,8 @@ int MTGDeck::addRandomCards(int howmany, int * setIds, int nbSets, int rarity, c
int collectionTotal = database->totalCards();
if (!collectionTotal) return 0;
char subtype[4096];
if (_subtype) sprintf(subtype, "%s", _subtype);
string subtype;
if (_subtype.size()) subtype = _subtype;
vector<int> subcollection;
int subtotal = 0;
@@ -911,7 +923,7 @@ int MTGDeck::addRandomCards(int howmany, int * setIds, int nbSets, int rarity, c
int r = card->getRarity();
if (r != Constants::RARITY_T && (rarity == -1 || r == rarity) && // remove tokens
card->setId != MTGSets::INTERNAL_SET && //remove cards that are defined in primitives. Those are workarounds (usually tokens) and should only be used internally
(!_subtype || card->data->hasSubtype(subtype)))
(!_subtype.size() || card->data->hasSubtype(subtype)))
{
int ok = 0;
@@ -1265,7 +1277,7 @@ MTGSetInfo* MTGSets::randomSet(int blockId, int atleast)
int blockSize(int blockId);
int MTGSets::Add(const char * name)
int MTGSets::Add(const string& name)
{
int setid = findSet(name);
if (setid != -1) return setid;
@@ -1344,7 +1356,7 @@ MTGSetInfo::~MTGSetInfo()
SAFE_DELETE(mPack);
}
MTGSetInfo::MTGSetInfo(string _id)
MTGSetInfo::MTGSetInfo(const string& _id)
{
string whitespaces(" \t\f\v\n\r");
id = _id;

View File

@@ -131,7 +131,8 @@ const char* Constants::MTGBasicAbilities[] = {
"poisondamager",//deals damage to players as poison counters.
"soulbond",
"lure",
"nolegend"
"nolegend",
"canplayfromgraveyard"
};
map<string,int> Constants::MTGBasicAbilitiesMap;
@@ -162,7 +163,7 @@ int Constants::GetColorStringIndex(string mtgColor)
return -1;
}
const char* Constants::MTGPhaseNames[] =
const string Constants::MTGPhaseNames[] =
{
"---",
"Untap",

View File

@@ -529,7 +529,7 @@ size_t MTGGameZone::getIndex(MTGCardInstance * card)
}
unsigned int MTGGameZone::countByType(const char * value)
unsigned int MTGGameZone::countByType(const string &value)
{
int result = 0;
int subTypeId = MTGAllCards::findType(value);
@@ -539,7 +539,7 @@ unsigned int MTGGameZone::countByType(const char * value)
{
result++;
}
else if(strcmp(value, "token") == 0 && cards[i]->isToken)
else if(value == "token" && cards[i]->isToken)
result++;
}
return result;

View File

@@ -293,7 +293,7 @@ void MTGPacks::loadAll()
sprintf(myFilename, "packs/%s",relative.c_str());
if (relative[0] == '.')
continue;
if (!strcmp(relative.c_str(), "default_booster.txt"))
if (relative == "default_booster.txt")
continue;
MTGPack * p = NEW MTGPack(myFilename);
if (!p->isValid())

View File

@@ -273,6 +273,7 @@ MTGEventBonus * MTGEventBonus::clone() const
{
return NEW MTGEventBonus(*this);
}
MTGPutInPlayRule::MTGPutInPlayRule(GameObserver* observer, int _id) :
PermanentAbility(observer, _id)
{
@@ -716,7 +717,6 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
copy->alternateCostPaid[alternateCostType] = 1;
spell->resolve();
SAFE_DELETE(spell);
game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, alternateCostType, 1);
}
else
{
@@ -997,9 +997,9 @@ int MTGSuspendRule::reactToClick(MTGCardInstance * card)
return 1;
}
const char * MTGSuspendRule::getMenuText()
const string MTGSuspendRule::getMenuText()
{
return suspendmenu.c_str();
return suspendmenu;
}
ostream& MTGSuspendRule::toString(ostream& out) const
@@ -1140,8 +1140,49 @@ MTGMorphCostRule * MTGMorphCostRule::clone() const
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
MTGPlayFromGraveyardRule::MTGPlayFromGraveyardRule(GameObserver* observer, int _id) :
MTGAlternativeCostRule(observer, _id)
{
aType = MTGAbility::PUT_INTO_PLAY;
}
int MTGPlayFromGraveyardRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
{
Player * player = game->currentlyActing();
ManaCost * cost = card->getManaCost();
if (!player->game->graveyard->hasCard(card))
return 0;
if (!card->has(Constants::CANPLAYFROMGRAVEYARD))
return 0;
return MTGAlternativeCostRule::isReactingToClick(card, mana, cost);
}
int MTGPlayFromGraveyardRule::reactToClick(MTGCardInstance * card)
{
if (!isReactingToClick(card))
return 0;
ManaCost * cost = card->getManaCost();
card->paymenttype = MTGAbility::PUT_INTO_PLAY;
return MTGAlternativeCostRule::reactToClick(card, cost, ManaCost::MANA_PAID);
}
ostream& MTGPlayFromGraveyardRule::toString(ostream& out) const
{
out << "MTGPlayFromGraveyardRule ::: (";
return MTGAbility::toString(out) << ")";
}
MTGPlayFromGraveyardRule * MTGPlayFromGraveyardRule::clone() const
{
return NEW MTGPlayFromGraveyardRule(*this);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
bool MTGAttackRule::select(Target* t)
{
@@ -1333,9 +1374,9 @@ int AAPlaneswalkerAttacked::resolve()
return 1;
}
const char* AAPlaneswalkerAttacked::getMenuText()
const string AAPlaneswalkerAttacked::getMenuText()
{
return menuText.c_str();
return menuText;
}
AAPlaneswalkerAttacked * AAPlaneswalkerAttacked::clone() const
@@ -1597,9 +1638,9 @@ int MTGBlockRule::reactToClick(MTGCardInstance * card)
return 1;
}
const char * MTGBlockRule::getMenuText()
const string MTGBlockRule::getMenuText()
{
return blockmenu.c_str();
return blockmenu;
}
ostream& MTGBlockRule::toString(ostream& out) const

View File

@@ -25,23 +25,23 @@ bool ModRules::load(string filename)
TiXmlElement* element = node->ToElement();
if (element != NULL)
{
if (strcmp(element->Value(), "menu") == 0)
if (element->ValueStr() == "menu")
{
menu.parse(element);
}
else if (strcmp(element->Value(), "general") == 0)
else if (element->ValueStr() == "general")
{
general.parse(element);
}
else if (strcmp(element->Value(), "cards") == 0)
else if (element->ValueStr() == "cards")
{
cards.parse(element);
}
else if (strcmp(element->Value(), "game") == 0)
else if (element->ValueStr() == "game")
{
game.parse(element);
}
else if (strcmp(element->Value(), "cardgui") == 0)
else if (element->ValueStr() == "cardgui")
{
cardgui.parse(element);
}

View File

@@ -7,6 +7,7 @@
#include "TranslateKeys.h"
#include "StyleManager.h"
#include <dirent.h>
#include "SimpleMenu.h"
//OptionItem
OptionItem::OptionItem(int _id, string _displayValue) :

View File

@@ -142,9 +142,10 @@ bool PhaseRing::extraDamagePhase(int id)
return false;
}
const char * PhaseRing::phaseName(int id)
const string& PhaseRing::phaseName(int id)
{
if (extraDamagePhase(id)) return "Combat Damage (2)";
static const string combatPhase2("Combat Damage (2)");
if (extraDamagePhase(id)) return combatPhase2;
return Constants::MTGPhaseNames[id];
}

View File

@@ -47,12 +47,12 @@ int PriceList::save()
return 1;
}
int PriceList::getPrice(int cardId)
int PriceList::getPrice(MTGCard * card)
{
map<int, int>::iterator it = prices.find(cardId);
map<int, int>::iterator it = prices.find(card->getId());
if (it != prices.end()) return (*it).second;
char rarity = collection->getCardById(cardId)->getRarity();
char rarity = card->getRarity();
switch (rarity)
{
case Constants::RARITY_M:
@@ -77,7 +77,11 @@ int PriceList::getPrice(int cardId)
return Constants::PRICE_1C;
break;
}
}
int PriceList::getPrice(int cardId)
{
return getPrice(collection->getCardById(cardId));
}
int PriceList::setPrice(int cardId, int price)
@@ -85,10 +89,23 @@ int PriceList::setPrice(int cardId, int price)
prices[cardId] = price;
return price;
}
int PriceList::setPrice(MTGCard * card, int price)
{
prices[card->getId()] = price;
return price;
}
int PriceList::getSellPrice(int cardid)
{
return getPrice(cardid);
return getPrice(collection->getCardById(cardid));
}
int PriceList::getSellPrice(MTGCard *card)
{
return getPrice(card);
}
float PriceList::difficultyScalar(float price, int cardid)
{
float badluck = (float) (abs(cardid + randomKey) % 201) / 100; //Float between 0 and 2.

View File

@@ -6,6 +6,7 @@
#include "Player.h"
#include "AIMomirPlayer.h"
#include "GameApp.h"
#include "MTGGameZones.h"
#include "MTGAbility.h"
#include "AllAbilities.h"

View File

@@ -328,7 +328,7 @@ void SimpleMenu::Update(float dt)
}
}
void SimpleMenu::Add(int id, const char * text, string desc, bool forceFocus)
void SimpleMenu::Add(int id, const string& text, string desc, bool forceFocus)
{
SimpleMenuItem * smi = NEW SimpleMenuItem(this, id, fontId, text, 0, mY + SimpleMenuConst::kVerticalMargin + mCount * SimpleMenuConst::kLineHeight,
(mCount == 0), autoTranslate);

View File

@@ -13,6 +13,7 @@
#include "PlayerData.h"
#include "MTGDeck.h"
#include "WFont.h"
#include "GameApp.h"
#include <JFileSystem.h>
#define LINE_SPACE 2
@@ -333,15 +334,15 @@ StoryDuel::StoryDuel(TiXmlElement* root, StoryFlow * mParent) :
if (element)
{
const char* textC = element->GetText();
if (strcmp(element->Value(), "onwin") == 0)
if (element->ValueStr() == "onwin")
{
onWin = textC;
}
else if (strcmp(element->Value(), "onlose") == 0)
else if (element->ValueStr() == "onlose")
{
onLose = textC;
}
else if (strcmp(element->Value(), "bg") == 0)
else if (element->ValueStr() == "bg")
{
string text = textC;
bg = string("campaigns/").append(mParent->folder).append("/").append(text);
@@ -396,10 +397,10 @@ int StoryPage::loadElement(TiXmlElement* element)
if (!element) return 0;
const char* textC = element->GetText();
string text = textC;
if (strcmp(element->Value(), "music") == 0)
if (element->ValueStr() == "music")
{
musicFile = string("campaigns/").append(mParent->folder).append("/").append(text);
if (!fileExists(musicFile.c_str())) musicFile = text;
if (!FileExists(musicFile)) musicFile = text;
return 1;
}
return 0;
@@ -434,15 +435,15 @@ StoryDialog::StoryDialog(TiXmlElement* root, StoryFlow * mParent) :
string sFont = safeAttribute(element, "font");
int font = atoi(sFont.c_str());
if (strcmp(element->Value(), "text") == 0)
if (element->ValueStr() == "text")
{
graphics.push_back(NEW StoryText(text, x, y, align, font));
}
else if (strcmp(element->Value(), "title") == 0)
else if (element->ValueStr() == "title")
{
graphics.push_back(NEW StoryText(text, x, y, "center", Fonts::MENU_FONT));
}
else if (strcmp(element->Value(), "img") == 0)
else if (element->ValueStr() == "img")
{
//special case to force center
if (sX.compare("") == 0)
@@ -452,7 +453,7 @@ StoryDialog::StoryDialog(TiXmlElement* root, StoryFlow * mParent) :
string img = string("campaigns/").append(mParent->folder).append("/").append(text);
graphics.push_back(NEW StoryImage(img, x, y));
}
else if (strcmp(element->Value(), "answer") == 0)
else if (element->ValueStr() == "answer")
{
string id = element->Attribute("goto");
if (!align.size()) align = "center";
@@ -461,7 +462,7 @@ StoryDialog::StoryDialog(TiXmlElement* root, StoryFlow * mParent) :
graphics.push_back(sc);
Add(sc);
}
else if (strcmp(element->Value(), "reward") == 0)
else if (element->ValueStr() == "reward")
{
string type = safeAttribute(element, "type");
string value = safeAttribute(element, "value");
@@ -553,7 +554,7 @@ StoryPage * StoryFlow::loadPage(TiXmlElement* element)
if (!typeNode) return NULL;
StoryPage * result = NULL;
const char* type = typeNode->ToElement()->GetText();
if (strcmp(type, "duel") == 0)
if (string("duel") == type)
{
result = NEW StoryDuel(element, this);
}
@@ -615,7 +616,7 @@ bool StoryFlow::parse(string path)
TiXmlElement* element = node->ToElement();
if (element != NULL)
{
if (strcmp(element->Value(), "page") == 0)
if (element->ValueStr() == "page")
{
string id = element->Attribute("id");

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