Compare commits
188 Commits
wagic-v0.1
...
releasing-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bb6cf4a4a | ||
|
|
8691e7e2c7 | ||
|
|
8717e148bf | ||
|
|
9faca83e18 | ||
|
|
fd081c4ad2 | ||
|
|
5d92553017 | ||
|
|
f0e6d820c7 | ||
|
|
545fc21260 | ||
|
|
8b68568106 | ||
|
|
739a5d9e2b | ||
|
|
4c627f74b6 | ||
|
|
1e610ff653 | ||
|
|
5d6557a49f | ||
|
|
7528329a58 | ||
|
|
c62597dce5 | ||
|
|
d8dfcdba67 | ||
|
|
7b5f00260b | ||
|
|
f9dc551942 | ||
|
|
718ceca919 | ||
|
|
89fb76a8e7 | ||
|
|
1cc65ab611 | ||
|
|
3b22354ad9 | ||
|
|
2b9977a334 | ||
|
|
12c5f31562 | ||
|
|
8cfd887375 | ||
|
|
292bf7b1d2 | ||
|
|
4041fe690b | ||
|
|
cb73e2b90d | ||
|
|
a1fa36a934 | ||
|
|
bdd0e6c042 | ||
|
|
ee217e94a8 | ||
|
|
38e19f7d35 | ||
|
|
0bbfd00d15 | ||
|
|
aaceb3c038 | ||
|
|
5efa7e10bd | ||
|
|
14c164364e | ||
|
|
4514725aba | ||
|
|
2b0f50bb88 | ||
|
|
a65fc0c0f0 | ||
|
|
99db363253 | ||
|
|
c25dfec67e | ||
|
|
dd7210d187 | ||
|
|
904b7a6d86 | ||
|
|
31b353c5ec | ||
|
|
0d350af1b6 | ||
|
|
3bc9c93bab | ||
|
|
2002bb4e16 | ||
|
|
7e9c4ddbdd | ||
|
|
12b71de63c | ||
|
|
15011961f4 | ||
|
|
b851103711 | ||
|
|
67b8af8d15 | ||
|
|
8100e390b1 | ||
|
|
72e6876001 | ||
|
|
96aeaffa1b | ||
|
|
74faa35b91 | ||
|
|
8bb58ca3b1 | ||
|
|
93d1a637b6 | ||
|
|
30e86ffcd8 | ||
|
|
cbe6c0c842 | ||
|
|
77eb7f2777 | ||
|
|
077ab10c05 | ||
|
|
1194463349 | ||
|
|
8de50532f2 | ||
|
|
334454655d | ||
|
|
d8d52e185d | ||
|
|
9f1d225259 | ||
|
|
0c72bfd4c4 | ||
|
|
55e0366f19 | ||
|
|
667b95f2b8 | ||
|
|
e90f6fe224 | ||
|
|
2289fffb8d | ||
|
|
826403a512 | ||
|
|
35fec3d9a0 | ||
|
|
e9eb86488e | ||
|
|
ae97abbf96 | ||
|
|
a8391112b0 | ||
|
|
4257592568 | ||
|
|
657479e0e4 | ||
|
|
9e969881fd | ||
|
|
2b434a7182 | ||
|
|
d2e41f98c3 | ||
|
|
318fc98a39 | ||
|
|
b7a4b7f6b9 | ||
|
|
ed03fb744d | ||
|
|
02be213d1e | ||
|
|
0d4db9ee54 | ||
|
|
ae927576c5 | ||
|
|
f08ddac77b | ||
|
|
9effa7c975 | ||
|
|
a70259b5ba | ||
|
|
bf0a0a1580 | ||
|
|
eb8b22b2d5 | ||
|
|
4095676b6b | ||
|
|
bedd1e8da8 | ||
|
|
965d4f6d45 | ||
|
|
0db2925e7a | ||
|
|
031f2dbffb | ||
|
|
dbece750f8 | ||
|
|
6699902c24 | ||
|
|
e8407caa2a | ||
|
|
69c6745f53 | ||
|
|
6f083389c2 | ||
|
|
9ee44ca091 | ||
|
|
3f0dd987f0 | ||
|
|
672b0be7bd | ||
|
|
9d5a83d588 | ||
|
|
5d0d130587 | ||
|
|
c85d857604 | ||
|
|
f68568cc1e | ||
|
|
89206b3a6b | ||
|
|
dc118c64b8 | ||
|
|
a43854420d | ||
|
|
a695323bc7 | ||
|
|
02a65ecd82 | ||
|
|
9ff087ecde | ||
|
|
47685f4892 | ||
|
|
7aaebdc661 | ||
|
|
8aa0b8cea0 | ||
|
|
fac44c4b48 | ||
|
|
9889186eab | ||
|
|
73f9319b92 | ||
|
|
fd6bc95539 | ||
|
|
0bb211a581 | ||
|
|
e0428ac7b0 | ||
|
|
3e94de985f | ||
|
|
9f0b70d1c9 | ||
|
|
1e8fc81aa3 | ||
|
|
352e3c2daa | ||
|
|
678a4734bb | ||
|
|
052e3abdb8 | ||
|
|
73c2d17080 | ||
|
|
ffbb228d2d | ||
|
|
306765c6b6 | ||
|
|
3cee80e3bc | ||
|
|
8209716fc9 | ||
|
|
e76c57d747 | ||
|
|
9c282aeb56 | ||
|
|
bbc310dec7 | ||
|
|
a37af1776a | ||
|
|
35697a65b4 | ||
|
|
6bed1666be | ||
|
|
f021866368 | ||
|
|
d7e527166c | ||
|
|
071a487100 | ||
|
|
f370899a8a | ||
|
|
331e126787 | ||
|
|
6c41e5c92c | ||
|
|
82e3ab3977 | ||
|
|
f2314ca673 | ||
|
|
94c3ac9ad9 | ||
|
|
5419d87e4e | ||
|
|
e1213d1c1f | ||
|
|
446ed20758 | ||
|
|
7a48c5e087 | ||
|
|
3ca2f1c1ed | ||
|
|
146872797b | ||
|
|
c6dc51c7d3 | ||
|
|
0ef92d154a | ||
|
|
2835bdf767 | ||
|
|
afc903e31b | ||
|
|
6294bb1eed | ||
|
|
9f16b2208d | ||
|
|
0a765b702b | ||
|
|
82de6f2840 | ||
|
|
90652fa73d | ||
|
|
e8c73aaf9d | ||
|
|
f95094a429 | ||
|
|
7a57de6608 | ||
|
|
14c2d522c2 | ||
|
|
6bf2147d94 | ||
|
|
fea5b04a77 | ||
|
|
ea98b769a7 | ||
|
|
017f6dd1ed | ||
|
|
784d127a6e | ||
|
|
f6c47b85e3 | ||
|
|
dac31994b6 | ||
|
|
74280aef1d | ||
|
|
8013d09e4f | ||
|
|
6bbe290762 | ||
|
|
57c9940244 | ||
|
|
db1c552321 | ||
|
|
f08f0ad3b9 | ||
|
|
a3a1bc2b79 | ||
|
|
9037699281 | ||
|
|
8d66f82179 | ||
|
|
b17d9d3f85 | ||
|
|
c5190a62cd |
28
.travis.yml
28
.travis.yml
@@ -1,2 +1,28 @@
|
||||
language: cpp
|
||||
script: "qmake projects/mtg/wagic-qt.pro CONFIG+=testsuite CONFIG+=debug && make -j 8"
|
||||
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"
|
||||
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 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
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
// dirty, but I get OS header includes this way
|
||||
#include "JGE.h"
|
||||
|
||||
#include "OutputCapturer.h"
|
||||
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
@@ -29,12 +31,23 @@ std::string ToHex(T* pointer)
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
|
||||
#ifdef QT_CONFIG
|
||||
|
||||
#ifdef CAPTURE_STDERR
|
||||
#define DebugTrace(inString) \
|
||||
{ \
|
||||
std::ostringstream stream; \
|
||||
stream << inString << std::endl; \
|
||||
qDebug("%s", stream.str().c_str()); \
|
||||
stream << inString; \
|
||||
OutputCapturer::add(stream.str()); \
|
||||
}
|
||||
#else // CAPTURE_STDERR
|
||||
#define DebugTrace(inString) \
|
||||
{ \
|
||||
std::ostringstream stream; \
|
||||
stream << inString; \
|
||||
qDebug("%s", stream.str().c_str()); \
|
||||
}
|
||||
#endif // CAPTURE_STDERR
|
||||
|
||||
#elif defined (ANDROID)
|
||||
#include <android/log.h>
|
||||
#define DebugTrace(inString) \
|
||||
@@ -48,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
|
||||
|
||||
@@ -44,6 +44,17 @@ typedef WPARAM LocalKeySym;
|
||||
#include <X11/keysym.h>
|
||||
typedef KeySym LocalKeySym;
|
||||
#define LOCAL_KEY_NONE XK_VoidSymbol
|
||||
#undef Status
|
||||
#undef Bool
|
||||
#undef None
|
||||
#undef CursorShape
|
||||
#undef KeyPress
|
||||
#undef KeyRelease
|
||||
#undef FocusIn
|
||||
#undef FocusOut
|
||||
#undef FontChange
|
||||
#undef Unsorted
|
||||
#undef GrayScale
|
||||
|
||||
#elif defined(ANDROID) // This is temporary until we understand how to send real key events from Java
|
||||
typedef long unsigned int LocalKeySym;
|
||||
|
||||
@@ -578,7 +578,7 @@ private:
|
||||
#if (!defined PSP)
|
||||
|
||||
GLuint mCurrentTex;
|
||||
#if (defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) || (defined WIN32)
|
||||
#if ((defined GL_ES_VERSION_2_0) || (defined GL_VERSION_2_0) || (defined WIN32)) && (!defined CONSOLE_CONFIG)
|
||||
// MVP matrix
|
||||
ESMatrix theMvpMatrix;
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
#elif defined USE_PHONON
|
||||
#include <phonon/AudioOutput>
|
||||
#include <phonon/MediaObject>
|
||||
#else
|
||||
#ifdef WIN32
|
||||
#elif defined WIN32
|
||||
#include <windows.h>
|
||||
#define WITH_FMOD
|
||||
#elif defined (PSP)
|
||||
@@ -43,10 +42,10 @@
|
||||
#include "JAudio.h"
|
||||
#include "JMP3.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_FMOD
|
||||
#include "../Dependencies/include/fmod.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
using namespace std;
|
||||
|
||||
@@ -75,6 +75,23 @@ enum {
|
||||
#define SCREEN_HEIGHT_F 272.0f
|
||||
|
||||
|
||||
#ifdef CONSOLE_CONFIG
|
||||
#define DEFAULT_BLEND 0
|
||||
#define BLEND_OPTION_ADD 0
|
||||
#define BLEND_OPTION_BLEND 0
|
||||
#define BLEND_ZERO 0
|
||||
#define BLEND_ONE 0
|
||||
#define BLEND_SRC_COLOR 0
|
||||
#define BLEND_ONE_MINUS_SRC_COLOR 0
|
||||
#define BLEND_SRC_ALPHA 0
|
||||
#define BLEND_ONE_MINUS_SRC_ALPHA 0
|
||||
#define BLEND_DST_ALPHA 0
|
||||
#define BLEND_ONE_MINUS_DST_ALPHA 0
|
||||
#define BLEND_DST_COLOR 0
|
||||
#define BLEND_ONE_MINUS_DST_COLOR 0
|
||||
#define BLEND_SRC_ALPHA_SATURATE 0
|
||||
#define GU_PSM_5551 0
|
||||
#else
|
||||
#ifdef WIN32
|
||||
// #define DEFAULT_BLEND BLEND_DEFAULT
|
||||
// #define BLEND_OPTION_ADD BLEND_COLORADD
|
||||
@@ -84,9 +101,10 @@ enum {
|
||||
#define BLEND_OPTION_ADD GU_TFX_ADD
|
||||
#define BLEND_OPTION_BLEND GU_TFX_BLEND
|
||||
#endif
|
||||
#endif // CONSOLE_CONFIG
|
||||
|
||||
#if (defined WIN32) && (!defined LINUX)
|
||||
#include <windows.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if defined(LINUX) && (!defined WIN32) || defined(IOS) || defined (ANDROID)
|
||||
typedef uint8_t byte;
|
||||
@@ -97,8 +115,21 @@ typedef bool BOOL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
#define PIXEL_TYPE DWORD
|
||||
#define ARGB(a, r, g, b) ((PIXEL_TYPE)((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
|
||||
#define RGBA(r, g, b, a) ((PIXEL_TYPE)((a) << 24) | ((b) << 16) | ((g) << 8) | (r))
|
||||
#ifndef PSP
|
||||
#define TEXTURE_FORMAT 0
|
||||
#endif //PSP
|
||||
|
||||
|
||||
#ifndef CONSOLE_CONFIG
|
||||
#ifndef QT_CONFIG
|
||||
#if defined (IOS)
|
||||
#import <OpenGLES/ES2/gl.h>
|
||||
@@ -113,7 +144,7 @@ typedef bool BOOL;
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#else
|
||||
# include <QtOpenGL>
|
||||
#include <QtOpenGL>
|
||||
#endif
|
||||
|
||||
#if (defined FORCE_GLES)
|
||||
@@ -127,14 +158,12 @@ typedef bool BOOL;
|
||||
#endif
|
||||
|
||||
#if defined (PSP)
|
||||
|
||||
#ifndef ABGR8888
|
||||
#define ABGR8888
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (ABGR8888)
|
||||
#define PIXEL_TYPE u32
|
||||
#ifndef ARGB
|
||||
#define ARGB(a, r, g, b) (PIXEL_TYPE)((a << 24) | (b << 16) | (g << 8) | r) // macro to assemble pixels in correct format
|
||||
#endif
|
||||
@@ -215,13 +244,6 @@ typedef struct
|
||||
|
||||
#else //non PSP
|
||||
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
|
||||
|
||||
#define BLEND_ZERO GL_ZERO
|
||||
#define BLEND_ONE GL_ONE
|
||||
@@ -235,44 +257,16 @@ typedef uint32_t u32;
|
||||
#define BLEND_ONE_MINUS_DST_COLOR GL_ONE_MINUS_DST_COLOR
|
||||
#define BLEND_SRC_ALPHA_SATURATE GL_SRC_ALPHA_SATURATE
|
||||
|
||||
#define ARGB(a, r, g, b) ((PIXEL_TYPE)((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
|
||||
#define RGBA(r, g, b, a) ((PIXEL_TYPE)((a) << 24) | ((b) << 16) | ((g) << 8) | (r))
|
||||
|
||||
#define TEXTURE_FORMAT 0
|
||||
#define GU_PSM_8888 0
|
||||
#define GU_PSM_5551 0
|
||||
#define GU_PSM_4444 0
|
||||
#define GU_PSM_5650 0
|
||||
#define PIXEL_TYPE DWORD
|
||||
#define GU_PSM_8888 0
|
||||
#define GU_PSM_5551 0
|
||||
#define GU_PSM_4444 0
|
||||
#define GU_PSM_5650 0
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef enum Buttons
|
||||
{
|
||||
JGE_BTN_NONE = 0, // No button pressed
|
||||
JGE_BTN_QUIT, // Home on PSP
|
||||
JGE_BTN_MENU, // Start on PSP
|
||||
JGE_BTN_CTRL, // Select
|
||||
JGE_BTN_POWER, // Hold
|
||||
JGE_BTN_SOUND, // Music note
|
||||
JGE_BTN_RIGHT,
|
||||
JGE_BTN_LEFT,
|
||||
JGE_BTN_UP,
|
||||
JGE_BTN_DOWN,
|
||||
JGE_BTN_OK, // Circle in Japan, Cross in Europe
|
||||
JGE_BTN_CANCEL, // Triangle
|
||||
JGE_BTN_PRI, // Square (primary)
|
||||
JGE_BTN_SEC, // Cross or Circle (secondary)
|
||||
JGE_BTN_PREV, // Left trigger
|
||||
JGE_BTN_NEXT, // Right trigger
|
||||
JGE_BTN_FULLSCREEN, // Switch to fullscreen (obviously, PC only)
|
||||
|
||||
JGE_BTN_MAX = JGE_BTN_FULLSCREEN + 1
|
||||
} JButton;
|
||||
|
||||
|
||||
#else
|
||||
typedef uint32_t GLuint;
|
||||
typedef float GLfloat;
|
||||
#endif //CONSOLE_CONFIG
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
struct Vertex
|
||||
@@ -542,5 +536,28 @@ public:
|
||||
};
|
||||
|
||||
|
||||
typedef enum Buttons
|
||||
{
|
||||
JGE_BTN_NONE = 0, // No button pressed
|
||||
JGE_BTN_QUIT, // Home on PSP
|
||||
JGE_BTN_MENU, // Start on PSP
|
||||
JGE_BTN_CTRL, // Select
|
||||
JGE_BTN_POWER, // Hold
|
||||
JGE_BTN_SOUND, // Music note
|
||||
JGE_BTN_RIGHT,
|
||||
JGE_BTN_LEFT,
|
||||
JGE_BTN_UP,
|
||||
JGE_BTN_DOWN,
|
||||
JGE_BTN_OK, // Circle in Japan, Cross in Europe
|
||||
JGE_BTN_CANCEL, // Triangle
|
||||
JGE_BTN_PRI, // Square (primary)
|
||||
JGE_BTN_SEC, // Cross or Circle (secondary)
|
||||
JGE_BTN_PREV, // Left trigger
|
||||
JGE_BTN_NEXT, // Right trigger
|
||||
JGE_BTN_FULLSCREEN, // Switch to fullscreen (obviously, PC only)
|
||||
|
||||
JGE_BTN_MAX = JGE_BTN_FULLSCREEN + 1
|
||||
} JButton;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
23
JGE/include/OutputCapturer.h
Normal file
23
JGE/include/OutputCapturer.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef OUTPUTCAPTURER_H
|
||||
#define OUTPUTCAPTURER_H
|
||||
|
||||
#if defined(QT_CONFIG)
|
||||
#include <Qt>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "Threading.h"
|
||||
|
||||
class OutputCapturer
|
||||
{
|
||||
private:
|
||||
static std::ostringstream stream;
|
||||
static boost::mutex mMutex;
|
||||
|
||||
public:
|
||||
static void add(const std::string& s);
|
||||
static void debugAndClear();
|
||||
static void clear();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // OUTPUTCAPTURER_H
|
||||
@@ -315,7 +315,6 @@ namespace boost
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "../include/DebugRoutines.h"
|
||||
#include "../include/JLogger.h"
|
||||
|
||||
namespace boost
|
||||
|
||||
@@ -3,15 +3,6 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/*************************** Macros and constants ***************************/
|
||||
// returns a number ranging from -1.0 to 1.0
|
||||
#define FRAND (((float)rand()-(float)rand())/RAND_MAX)
|
||||
#define Clamp(x, min, max) x = (x<min ? min : x<max ? x : max);
|
||||
|
||||
#define SQUARE(x) (x)*(x)
|
||||
|
||||
|
||||
struct Vector3D
|
||||
{
|
||||
Vector3D(float x, float y, float z) : x(x), y(y), z(z) {}
|
||||
@@ -63,7 +54,7 @@ struct Vector3D
|
||||
|
||||
float Length()
|
||||
{
|
||||
float length = (float)sqrt(SQUARE(x) + SQUARE(y) + SQUARE(z));
|
||||
float length = sqrt(x*x + y*y + z*z);
|
||||
return (length != 0.0f) ? length : 1.0f;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -16,9 +16,9 @@ User folder is the only one that is really needed to guarantee both read and wri
|
||||
The content that users should not be touching.
|
||||
*/
|
||||
|
||||
#if defined(ANDROID)
|
||||
#include "../../include/PrecompiledHeader.h"
|
||||
#endif
|
||||
#ifndef PSP
|
||||
#include "PrecompiledHeader.h"
|
||||
#endif //PSP
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable : 4786)
|
||||
@@ -34,6 +34,10 @@ The content that users should not be touching.
|
||||
#include "../include/JLogger.h"
|
||||
#include <dirent.h>
|
||||
|
||||
#ifdef QT_CONFIG
|
||||
#include <QDir>
|
||||
#endif
|
||||
|
||||
JFileSystem* JFileSystem::mInstance = NULL;
|
||||
|
||||
JZipCache::JZipCache()
|
||||
@@ -121,13 +125,18 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
|
||||
|
||||
DebugTrace("User path " << userPath);
|
||||
#elif defined (QT_CONFIG)
|
||||
QDir dir(QDir::homePath());
|
||||
dir.cd(USERDIR);
|
||||
|
||||
QDir sysDir("projects/mtg/bin/Res");
|
||||
QDir sysDir(RESDIR);
|
||||
QDir dir(QDir::homePath());
|
||||
dir.mkdir(USERDIR);
|
||||
dir.cd(USERDIR);
|
||||
|
||||
userPath = QDir::toNativeSeparators(dir.absolutePath()).toStdString();
|
||||
systemPath = QDir::toNativeSeparators(sysDir.absolutePath()).toStdString();
|
||||
|
||||
DebugTrace("User path " << userPath);
|
||||
DebugTrace("System path " << systemPath);
|
||||
DebugTrace("Current path " << QDir::currentPath().toStdString());
|
||||
#else
|
||||
//Find the Res.txt file and matching Res folders for backwards compatibility
|
||||
ifstream mfile("Res.txt");
|
||||
|
||||
506
JGE/src/JGfx-fake.cpp
Normal file
506
JGE/src/JGfx-fake.cpp
Normal file
@@ -0,0 +1,506 @@
|
||||
//-------------------------------------------------------------------------------------
|
||||
//
|
||||
// JGE++ is a hardware accelerated 2D game SDK for PSP/Windows.
|
||||
#include "../../include/JGE.h"
|
||||
#include "../../include/JRenderer.h"
|
||||
#include "../../include/JResourceManager.h"
|
||||
#include "../../include/JFileSystem.h"
|
||||
#include "../../include/JAssert.h"
|
||||
|
||||
JQuad::JQuad(JTexture *tex, float x, float y, float width, float height)
|
||||
:mTex(tex), mX(x), mY(y), mWidth(width), mHeight(height)
|
||||
{
|
||||
JASSERT(tex != NULL);
|
||||
JRenderer::GetInstance()->TransferTextureToGLContext(*tex);
|
||||
|
||||
mHotSpotX = 0.0f;
|
||||
mHotSpotY = 0.0f;
|
||||
//mBlend = BLEND_DEFAULT;
|
||||
for (int i=0;i<4;i++)
|
||||
mColor[i].color = 0xFFFFFFFF;
|
||||
|
||||
mHFlipped = false;
|
||||
mVFlipped = false;
|
||||
|
||||
SetTextureRect(x, y, width, height);
|
||||
}
|
||||
|
||||
void JQuad::SetTextureRect(float x, float y, float w, float h)
|
||||
{
|
||||
mX = x;
|
||||
mY = y;
|
||||
mWidth = w;
|
||||
mHeight = h;
|
||||
|
||||
if(mTex)
|
||||
{
|
||||
mTX0 = x/mTex->mTexWidth;
|
||||
mTY0 = y/mTex->mTexHeight;
|
||||
mTX1 = (x+w)/mTex->mTexWidth;
|
||||
mTY1 = (y+h)/mTex->mTexHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JQuad::GetTextureRect(float *x, float *y, float *w, float *h)
|
||||
{
|
||||
*x=mX; *y=mY; *w=mWidth; *h=mHeight;
|
||||
}
|
||||
|
||||
|
||||
void JQuad::SetColor(PIXEL_TYPE color)
|
||||
{
|
||||
for (int i=0;i<4;i++)
|
||||
mColor[i].color = color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JQuad::SetHotSpot(float x, float y)
|
||||
{
|
||||
mHotSpotX = x;
|
||||
mHotSpotY = y;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
JTexture::JTexture() : mWidth(0), mHeight(0), mBuffer(NULL)
|
||||
{
|
||||
mTexId = -1;
|
||||
}
|
||||
|
||||
JTexture::~JTexture()
|
||||
{
|
||||
if (mBuffer)
|
||||
{
|
||||
delete [] mBuffer;
|
||||
mBuffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void JTexture::UpdateBits(int x, int y, int width, int height, PIXEL_TYPE* bits)
|
||||
{
|
||||
JRenderer::GetInstance()->BindTexture(this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
JRenderer* JRenderer::mInstance = NULL;
|
||||
bool JRenderer::m3DEnabled = false;
|
||||
|
||||
void JRenderer::Set3DFlag(bool flag) { m3DEnabled = flag; }
|
||||
|
||||
JRenderer* JRenderer::GetInstance()
|
||||
{
|
||||
if (mInstance == NULL)
|
||||
{
|
||||
mInstance = new JRenderer();
|
||||
|
||||
JASSERT(mInstance != NULL);
|
||||
|
||||
mInstance->InitRenderer();
|
||||
}
|
||||
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Destroy()
|
||||
{
|
||||
if (mInstance)
|
||||
{
|
||||
mInstance->DestroyRenderer();
|
||||
delete mInstance;
|
||||
mInstance = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
JRenderer::JRenderer() : mActualWidth(SCREEN_WIDTH_F), mActualHeight(SCREEN_HEIGHT_F)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
JRenderer::~JRenderer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JRenderer::InitRenderer()
|
||||
{
|
||||
mCurrentTextureFilter = TEX_FILTER_NONE;
|
||||
mImageFilter = NULL;
|
||||
|
||||
mCurrTexBlendSrc = BLEND_SRC_ALPHA;
|
||||
mCurrTexBlendDest = BLEND_ONE_MINUS_SRC_ALPHA;
|
||||
|
||||
// mLineWidth = 1.0f;
|
||||
mCurrentTex = -1;
|
||||
mFOV = 75.0f;
|
||||
|
||||
#ifdef USING_MATH_TABLE
|
||||
for (int i=0;i<360;i++)
|
||||
{
|
||||
mSinTable[i] = sinf(i*DEG2RAD);
|
||||
mCosTable[i] = cosf(i*DEG2RAD);
|
||||
}
|
||||
#endif
|
||||
|
||||
mCurrentRenderMode = MODE_UNKNOWN;
|
||||
}
|
||||
|
||||
void JRenderer::DestroyRenderer()
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::BeginScene()
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::EndScene()
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::BindTexture(JTexture *tex)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::EnableTextureFilter(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
mCurrentTextureFilter = TEX_FILTER_LINEAR;
|
||||
else
|
||||
mCurrentTextureFilter = TEX_FILTER_NEAREST;
|
||||
|
||||
mCurrentTex = -1;
|
||||
}
|
||||
|
||||
void Swap(float *a, float *b)
|
||||
{
|
||||
float n=*a;
|
||||
*a = *b;
|
||||
*b = n;
|
||||
}
|
||||
|
||||
void JRenderer::RenderQuad(JQuad* quad, float xo, float yo, float angle, float xScale, float yScale)
|
||||
{
|
||||
//yo = SCREEN_HEIGHT-yo-1;//-(quad->mHeight);
|
||||
float width = quad->mWidth;
|
||||
float height = quad->mHeight;
|
||||
float x = -quad->mHotSpotX;
|
||||
float y = quad->mHotSpotY;
|
||||
|
||||
Vector2D pt[4];
|
||||
pt[3] = Vector2D(x, y);
|
||||
pt[2] = Vector2D(x+width, y);
|
||||
pt[1] = Vector2D(x+width, y-height);
|
||||
pt[0] = Vector2D(x, y-height);
|
||||
|
||||
|
||||
Vector2D uv[4];
|
||||
uv[0] = Vector2D(quad->mTX0, quad->mTY1);
|
||||
uv[1] = Vector2D(quad->mTX1, quad->mTY1);
|
||||
uv[2] = Vector2D(quad->mTX1, quad->mTY0);
|
||||
uv[3] = Vector2D(quad->mTX0, quad->mTY0);
|
||||
|
||||
if (quad->mHFlipped)
|
||||
{
|
||||
Swap(&uv[0].x, &uv[1].x);
|
||||
Swap(&uv[2].x, &uv[3].x);
|
||||
}
|
||||
|
||||
if (quad->mVFlipped)
|
||||
{
|
||||
Swap(&uv[0].y, &uv[2].y);
|
||||
Swap(&uv[1].y, &uv[3].y);
|
||||
}
|
||||
|
||||
BindTexture(quad->mTex);
|
||||
|
||||
yo = SCREEN_HEIGHT_F - yo;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RenderQuad(JQuad* quad, VertexColor* pt)
|
||||
{
|
||||
for (int i=0;i<4;i++)
|
||||
{
|
||||
pt[i].y = SCREEN_HEIGHT_F - pt[i].y;
|
||||
quad->mColor[i].color = pt[i].color;
|
||||
}
|
||||
|
||||
Vector2D uv[4];
|
||||
uv[0] = Vector2D(quad->mTX0, quad->mTY1);
|
||||
uv[1] = Vector2D(quad->mTX1, quad->mTY1);
|
||||
uv[2] = Vector2D(quad->mTX1, quad->mTY0);
|
||||
uv[3] = Vector2D(quad->mTX0, quad->mTY0);
|
||||
|
||||
BindTexture(quad->mTex);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillRect(float x, float y, float width, float height, PIXEL_TYPE color)
|
||||
{
|
||||
y = SCREEN_HEIGHT_F - y - height;
|
||||
|
||||
JColor col;
|
||||
col.color = color;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawRect(float x, float y, float width, float height, PIXEL_TYPE color)
|
||||
{
|
||||
y = SCREEN_HEIGHT_F - y - height;
|
||||
|
||||
JColor col;
|
||||
col.color = color;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillRect(float x, float y, float width, float height, PIXEL_TYPE* colors)
|
||||
{
|
||||
JColor col[4];
|
||||
for (int i=0;i<4;i++)
|
||||
col[i].color = colors[i];
|
||||
|
||||
FillRect(x, y, width, height, col);
|
||||
}
|
||||
|
||||
void JRenderer::FillRect(float x, float y, float width, float height, JColor* colors)
|
||||
{
|
||||
y = SCREEN_HEIGHT_F - y - height;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawLine(float x1, float y1, float x2, float y2, PIXEL_TYPE color)
|
||||
{
|
||||
// glLineWidth (mLineWidth);
|
||||
JColor col;
|
||||
col.color = color;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Plot(float x, float y, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::PlotArray(float *x, float *y, int count, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::ScreenShot(const char* filename __attribute__((unused)))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::EnableVSync(bool flag __attribute__((unused)))
|
||||
{
|
||||
// if (flag)
|
||||
// hge->System_SetState(HGE_FPS, 60); // HGEFPS_VSYNC
|
||||
// else
|
||||
// hge->System_SetState(HGE_FPS, HGEFPS_UNLIMITED);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::ClearScreen(PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetTexBlend(int src, int dest)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetTexBlendSrc(int src)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetTexBlendDest(int dest)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Enable2D()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Enable3D()
|
||||
{ /* NOT USED
|
||||
if (!m3DEnabled)
|
||||
return;
|
||||
|
||||
if (mCurrentRenderMode == MODE_3D)
|
||||
return;
|
||||
|
||||
mCurrentRenderMode = MODE_3D;
|
||||
|
||||
glViewport (0, 0, (GLsizei)SCREEN_WIDTH, (GLsizei)SCREEN_HEIGHT); // Reset The Current Viewport
|
||||
glMatrixMode (GL_PROJECTION); // Select The Projection Matrix
|
||||
glLoadIdentity (); // Reset The Projection Matrix
|
||||
gluPerspective (mFOV, (GLfloat)SCREEN_WIDTH/(GLfloat)SCREEN_HEIGHT, // Calculate The Aspect Ratio Of The Window
|
||||
0.5f, 1000.0f);
|
||||
glMatrixMode (GL_MODELVIEW); // Select The Modelview Matrix
|
||||
glLoadIdentity (); // Reset The Modelview Matrix
|
||||
|
||||
glEnable (GL_DEPTH_TEST); */
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetClip(int, int, int, int)
|
||||
{// NOT USED
|
||||
//glScissor(x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::LoadIdentity()
|
||||
{// NOT USED
|
||||
//glLoadIdentity();
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::Translate(float, float, float)
|
||||
{// NOT USED
|
||||
//glTranslatef(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RotateX(float)
|
||||
{// NOT USED
|
||||
//glRotatef(angle*RAD2DEG, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RotateY(float)
|
||||
{// NOT USED
|
||||
//glRotatef(angle*RAD2DEG, 0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::RotateZ(float)
|
||||
{// NOT USED
|
||||
//glRotatef(angle*RAD2DEG, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::PushMatrix()
|
||||
{// NOT USED
|
||||
//glPushMatrix();
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::PopMatrix()
|
||||
{// NOT USED
|
||||
//glPopMatrix();
|
||||
}
|
||||
|
||||
void JRenderer::RenderTriangles(JTexture* texture, Vertex3D *vertices, int start, int count)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetFOV(float fov)
|
||||
{
|
||||
mFOV = fov;
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillPolygon(float* x, float* y, int count, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawPolygon(float* x, float* y, int count, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawLine(float x1, float y1, float x2, float y2, float lineWidth, PIXEL_TYPE color)
|
||||
{
|
||||
float dy=y2-y1;
|
||||
float dx=x2-x1;
|
||||
if(dy==0 && dx==0)
|
||||
return;
|
||||
|
||||
float l=(float)hypot(dx,dy);
|
||||
|
||||
float x[4];
|
||||
float y[4];
|
||||
|
||||
x[0]=x1+lineWidth*(y2-y1)/l;
|
||||
y[0]=y1-lineWidth*(x2-x1)/l;
|
||||
|
||||
x[1]=x1-lineWidth*(y2-y1)/l;
|
||||
y[1]=y1+lineWidth*(x2-x1)/l;
|
||||
|
||||
x[2]=x2-lineWidth*(y2-y1)/l;
|
||||
y[2]=y2+lineWidth*(x2-x1)/l;
|
||||
|
||||
x[3]=x2+lineWidth*(y2-y1)/l;
|
||||
y[3]=y2-lineWidth*(x2-x1)/l;
|
||||
|
||||
FillPolygon(x, y, 4, color);
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawCircle(float x, float y, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
void JRenderer::FillCircle(float x, float y, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::DrawPolygon(float x, float y, float size, int count, float startingAngle, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::FillPolygon(float x, float y, float size, int count, float startingAngle, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JRenderer::SetImageFilter(JImageFilter* imageFilter)
|
||||
{
|
||||
mImageFilter = imageFilter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::DrawRoundRect(float x, float y, float w, float h, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JRenderer::FillRoundRect(float x, float y, float w, float h, float radius, PIXEL_TYPE color)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
22
JGE/src/OutputCapturer.cpp
Normal file
22
JGE/src/OutputCapturer.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "../include/OutputCapturer.h"
|
||||
|
||||
std::ostringstream OutputCapturer::stream;
|
||||
boost::mutex OutputCapturer::mMutex;
|
||||
|
||||
void OutputCapturer::add(const std::string& s)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(mMutex);
|
||||
stream << s << "\n";
|
||||
}
|
||||
|
||||
void OutputCapturer::debugAndClear()
|
||||
{
|
||||
stream.flush();
|
||||
qDebug("%s", stream.str().c_str());
|
||||
stream.str("");
|
||||
}
|
||||
|
||||
void OutputCapturer::clear()
|
||||
{
|
||||
stream.str("");
|
||||
}
|
||||
105
JGE/src/Qtconsole.cpp
Normal file
105
JGE/src/Qtconsole.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
#include "../include/JGE.h"
|
||||
#include "../include/JTypes.h"
|
||||
#include "../include/JApp.h"
|
||||
#include "../include/JFileSystem.h"
|
||||
#include "../include/JRenderer.h"
|
||||
#include "../include/JGameLauncher.h"
|
||||
|
||||
#include "TestSuiteAI.h"
|
||||
#include "GameOptions.h"
|
||||
#include "MTGDeck.h"
|
||||
#include "DebugRoutines.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
class WagicWrapper
|
||||
{
|
||||
public:
|
||||
WagicWrapper();
|
||||
virtual ~WagicWrapper();
|
||||
|
||||
public:
|
||||
// used mainly to mesure the delta between 2 updates
|
||||
static QElapsedTimer g_startTimer;
|
||||
|
||||
private:
|
||||
JGE* m_engine;
|
||||
JApp* m_app;
|
||||
JGameLauncher* m_launcher;
|
||||
};
|
||||
|
||||
QElapsedTimer WagicWrapper::g_startTimer;
|
||||
|
||||
int JGEGetTime()
|
||||
{
|
||||
return (int)WagicWrapper::g_startTimer.elapsed();
|
||||
}
|
||||
|
||||
bool JGEToggleFullscreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void JGECreateDefaultBindings()
|
||||
{
|
||||
}
|
||||
|
||||
WagicWrapper::WagicWrapper()
|
||||
{
|
||||
m_launcher = new JGameLauncher();
|
||||
u32 flags = m_launcher->GetInitFlags();
|
||||
if ((flags&JINIT_FLAG_ENABLE3D)!=0)
|
||||
{
|
||||
JRenderer::Set3DFlag(true);
|
||||
}
|
||||
|
||||
JGECreateDefaultBindings();
|
||||
|
||||
m_engine = JGE::GetInstance();
|
||||
m_app = m_launcher->GetGameApp();
|
||||
m_app->Create();
|
||||
m_engine->SetApp(m_app);
|
||||
JRenderer::GetInstance()->Enable2D();
|
||||
g_startTimer.restart();
|
||||
}
|
||||
|
||||
WagicWrapper::~WagicWrapper()
|
||||
{
|
||||
if(m_launcher)
|
||||
{
|
||||
delete m_launcher;
|
||||
m_launcher = NULL;
|
||||
}
|
||||
|
||||
if(m_engine)
|
||||
m_engine->SetApp(NULL);
|
||||
|
||||
if (m_app)
|
||||
{
|
||||
m_app->Destroy();
|
||||
delete m_app;
|
||||
m_app = NULL;
|
||||
}
|
||||
|
||||
JGE::Destroy();
|
||||
m_engine = NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
int result = 0;
|
||||
WagicWrapper* wagicCore = new WagicWrapper();
|
||||
MTGCollection()->loadFolder("sets/primitives/");
|
||||
MTGCollection()->loadFolder("sets/", "_cards.dat");
|
||||
options.reloadProfile();
|
||||
TestSuite testSuite("test/_tests.txt");
|
||||
result = testSuite.run();
|
||||
delete wagicCore;
|
||||
DebugTrace("TestSuite done: failed test: " << result << " out of " << testSuite.nbTests + testSuite.nbAITests << " total");
|
||||
#ifdef CAPTURE_STDERR
|
||||
OutputCapturer::debugAndClear();
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -823,7 +823,7 @@ void JRenderer::BeginScene()
|
||||
esMatrixLoadIdentity(&theMvpMatrix);
|
||||
esOrtho(&theMvpMatrix, 0.0f, SCREEN_WIDTH_F, 0.0f, SCREEN_HEIGHT_F-1.0f,-1.0f, 1.0f);
|
||||
#endif //(!defined GL_ES_VERSION_2_0) && (!defined GL_VERSION_2_0)
|
||||
#if (defined WIN32) || ((defined GL_VERSION_ES_CM_1_1) && (!defined IOS))
|
||||
#if (defined WIN32 && !defined GL_ES_VERSION_2_0) || ((defined GL_VERSION_ES_CM_1_1) && (!defined IOS))
|
||||
float scaleH = mActualHeight/SCREEN_HEIGHT_F;
|
||||
float scaleW = mActualWidth/SCREEN_WIDTH_F;
|
||||
if (scaleH != 1.0f || scaleW != 1.0f)
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
1
projects/mtg/Android/.gitignore
vendored
1
projects/mtg/Android/.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
/gen
|
||||
/bin
|
||||
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
|
||||
<activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity" android:screenOrientation="sensorLandscape"/>
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9"/>
|
||||
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/>
|
||||
</manifest>
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/gen/net/wagic/app/R.java \
|
||||
: /Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/drawable-hdpi/icon.png \
|
||||
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/drawable-ldpi/icon.png \
|
||||
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/drawable-mdpi/icon.png \
|
||||
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/layout/main.xml \
|
||||
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/res/values/strings.xml \
|
||||
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/res/drawable-hdpi/icon.png \
|
||||
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/res/drawable-ldpi/icon.png \
|
||||
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/res/drawable-mdpi/icon.png \
|
||||
/Volumes/data/home/mnguyen/Projects/eclipse-workspace/wagic/projects/mtg/Android/bin/AndroidManifest.xml \
|
||||
@@ -1,6 +0,0 @@
|
||||
/** Automatically generated file. DO NOT MODIFY */
|
||||
package net.wagic.app;
|
||||
|
||||
public final class BuildConfig {
|
||||
public final static boolean DEBUG = true;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package net.wagic.app;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int icon=0x7f020000;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int mainLayout=0x7f050000;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int main=0x7f030000;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f040000;
|
||||
public static final int app_version=0x7f040001;
|
||||
public static final int info_text=0x7f040002;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -41,7 +41,6 @@ LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.cpp \
|
||||
$(MTG_PATH)/src/AllAbilities.cpp \
|
||||
$(MTG_PATH)/src/CardDescriptor.cpp \
|
||||
$(MTG_PATH)/src/CardDisplay.cpp \
|
||||
$(MTG_PATH)/src/CardEffect.cpp \
|
||||
$(MTG_PATH)/src/CardGui.cpp \
|
||||
$(MTG_PATH)/src/CardPrimitive.cpp \
|
||||
$(MTG_PATH)/src/CardSelector.cpp \
|
||||
@@ -137,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 \
|
||||
|
||||
Binary file not shown.
@@ -54,10 +54,6 @@ import android.view.View.OnKeyListener;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.FrameLayout.LayoutParams;
|
||||
|
||||
import com.google.ads.AdRequest;
|
||||
import com.google.ads.AdSize;
|
||||
import com.google.ads.AdView;
|
||||
|
||||
/**
|
||||
* SDL Activity
|
||||
*/
|
||||
@@ -68,7 +64,6 @@ public class SDLActivity extends Activity implements OnKeyListener
|
||||
public static String TAG = Activity.class.getCanonicalName();
|
||||
|
||||
// Main components
|
||||
private static AdView mAdView;
|
||||
private static SDLActivity mSingleton;
|
||||
private static SDLSurface mSurface;
|
||||
|
||||
@@ -422,25 +417,12 @@ public class SDLActivity extends Activity implements OnKeyListener
|
||||
SurfaceHolder holder = mSurface.getHolder();
|
||||
holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
|
||||
|
||||
// Create the adView
|
||||
mAdView = new AdView(this, AdSize.BANNER, "a14e9009f88864f"); // "a14dc0ab7b27413" <-- for the alpha);
|
||||
|
||||
_videoLayout.addView(mSurface, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
||||
_videoLayout.addView(mAdView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.BOTTOM + Gravity.CENTER_HORIZONTAL));
|
||||
// mGLView.setFocusableInTouchMode(true);
|
||||
// mGLView.setFocusable(true);
|
||||
// adView.requestFreshAd();
|
||||
setContentView(_videoLayout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
|
||||
mSurface.requestFocus();
|
||||
|
||||
AdRequest request = new AdRequest();
|
||||
|
||||
request.addTestDevice(AdRequest.TEST_EMULATOR);
|
||||
request.addTestDevice("1DA1E070BC7D4ABE8BA77EB73C2CB0AA"); // wololo's phone
|
||||
request.addTestDevice("C386F3830A9789C649098A817BF54C04"); // xawotihs's tablet
|
||||
|
||||
// Initiate a generic request to load it with an ad
|
||||
mAdView.loadAd(request);
|
||||
}
|
||||
|
||||
// Setup
|
||||
@@ -512,14 +494,6 @@ public class SDLActivity extends Activity implements OnKeyListener
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((command.compareTo("entergamestate:menu") == 0) || (command.compareTo("enterduelphase:end") == 0))
|
||||
{
|
||||
mAdView.setVisibility(View.VISIBLE);
|
||||
} else if (command.compareTo("leavegamestate:menu") == 0)
|
||||
{
|
||||
mAdView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
// Messages from the SDLMain thread
|
||||
|
||||
@@ -1,4 +1,33 @@
|
||||
OBJS = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.o objs/ActionLayer.o objs/ActionStack.o objs/AIHints.o objs/AIMomirPlayer.o objs/AIPlayer.o objs/AIPlayerBaka.o objs/AIStats.o objs/AllAbilities.o objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o objs/CardEffect.o objs/CardPrimitive.o objs/CardSelector.o objs/CardSelectorSingleton.o objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o objs/DeckDataWrapper.o objs/DeckEditorMenu.o objs/DeckMenu.o objs/DeckMenuItem.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o objs/GameObserver.o objs/GameOptions.o objs/GameState.o objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o objs/DeckManager.o objs/GameStateMenu.o objs/GameStateOptions.o objs/GameStateShop.o objs/GameStateStory.o objs/GameStateTransitions.o objs/GuiAvatars.o objs/GuiBackground.o objs/GuiCardsController.o objs/GuiCombat.o objs/GuiFrame.o objs/GuiHand.o objs/GuiLayers.o objs/GuiMana.o objs/GuiPhaseBar.o objs/GuiPlay.o objs/GuiStatic.o objs/IconButton.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o objs/ModRules.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o objs/MTGPack.o objs/MTGRules.o objs/Navigator.o objs/ObjectAnalytics.o objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/PlayRestrictions.o objs/Pos.o objs/PrecompiledHeader.o objs/PriceList.o objs/ReplacementEffects.o objs/Rules.o objs/SimpleMenu.o objs/SimpleButton.o objs/SimpleMenuItem.o objs/SimplePad.o objs/SimplePopup.o objs/StoryFlow.o objs/StyleManager.o objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TextScroller.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 = objs/InteractiveButton.o objs/AbilityParser.o objs/ActionElement.o\
|
||||
objs/ActionLayer.o objs/ActionStack.o objs/AIHints.o objs/AIMomirPlayer.o\
|
||||
objs/AIPlayer.o objs/AIPlayerBaka.o objs/AIStats.o objs/AllAbilities.o\
|
||||
objs/CardGui.o objs/CardDescriptor.o objs/CardDisplay.o\
|
||||
objs/CardPrimitive.o objs/CardSelector.o objs/CardSelectorSingleton.o\
|
||||
objs/Counters.o objs/Credits.o objs/Damage.o objs/DamagerDamaged.o\
|
||||
objs/DeckDataWrapper.o objs/DeckEditorMenu.o objs/DeckMenu.o\
|
||||
objs/DeckMenuItem.o objs/DeckMetaData.o objs/DeckStats.o objs/DuelLayers.o\
|
||||
objs/Effects.o objs/ExtraCost.o objs/GameApp.o objs/GameLauncher.o\
|
||||
objs/GameObserver.o objs/GameOptions.o objs/GameState.o\
|
||||
objs/GameStateAwards.o objs/GameStateDeckViewer.o objs/GameStateDuel.o\
|
||||
objs/DeckManager.o objs/GameStateMenu.o objs/GameStateOptions.o\
|
||||
objs/GameStateShop.o objs/GameStateStory.o objs/GameStateTransitions.o\
|
||||
objs/GuiAvatars.o objs/GuiBackground.o objs/GuiCardsController.o\
|
||||
objs/GuiCombat.o objs/GuiFrame.o objs/GuiHand.o objs/GuiLayers.o\
|
||||
objs/GuiMana.o objs/GuiPhaseBar.o objs/GuiPlay.o objs/GuiStatic.o\
|
||||
objs/IconButton.o objs/ManaCost.o objs/ManaCostHybrid.o objs/MenuItem.o\
|
||||
objs/ModRules.o objs/MTGAbility.o objs/MTGCardInstance.o objs/MTGCard.o\
|
||||
objs/MTGDeck.o objs/MTGDefinitions.o objs/MTGGamePhase.o objs/MTGGameZones.o\
|
||||
objs/MTGPack.o objs/MTGRules.o objs/Navigator.o objs/ObjectAnalytics.o\
|
||||
objs/OptionItem.o objs/PhaseRing.o objs/Player.o objs/PlayerData.o\
|
||||
objs/PlayGuiObjectController.o objs/PlayGuiObject.o objs/PlayRestrictions.o\
|
||||
objs/Pos.o objs/PrecompiledHeader.o objs/PriceList.o objs/ReplacementEffects.o\
|
||||
objs/Rules.o objs/SimpleMenu.o objs/SimpleButton.o objs/SimpleMenuItem.o\
|
||||
objs/SimplePad.o objs/SimplePopup.o objs/StoryFlow.o objs/StyleManager.o\
|
||||
objs/Subtypes.o objs/TargetChooser.o objs/TargetsList.o objs/TextScroller.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/CarouselDeckView.o objs/GridDeckView.o objs/DeckView.o
|
||||
DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS))
|
||||
|
||||
RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache)
|
||||
@@ -44,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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -16,6 +16,7 @@ auto=flashbackrule
|
||||
auto=retracerule
|
||||
auto=suspendrule
|
||||
auto=morphrule
|
||||
auto=playfromgraveyardrule
|
||||
auto=attackrule
|
||||
auto=blockrule
|
||||
auto=combattriggerrule
|
||||
|
||||
@@ -1513,3 +1513,8 @@ primitive=Zephyr Net
|
||||
id=142357
|
||||
rarity=C
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Avatar Token
|
||||
id=-140233
|
||||
rarity=T
|
||||
[/card]
|
||||
|
||||
@@ -1248,3 +1248,8 @@ primitive=Zombie Goliath
|
||||
id=190545
|
||||
rarity=C
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Avatar Token
|
||||
id=-191239
|
||||
rarity=T
|
||||
[/card]
|
||||
|
||||
@@ -1257,4 +1257,9 @@ rarity=U
|
||||
primitive=Yavimaya Wurm
|
||||
id=205221
|
||||
rarity=C
|
||||
[/card]
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Avatar Token
|
||||
id=-205957
|
||||
rarity=T
|
||||
[/card]
|
||||
|
||||
106
projects/mtg/bin/Res/sets/V13/_cards.dat
Normal file
106
projects/mtg/bin/Res/sets/V13/_cards.dat
Normal file
@@ -0,0 +1,106 @@
|
||||
[meta]
|
||||
author=Wagic Team
|
||||
name=From the Vault: Twenty
|
||||
block=Vault
|
||||
year=2013
|
||||
[/meta]
|
||||
[card]
|
||||
primitive=Akroma's Vengeance
|
||||
id=373328
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Chainer's Edict
|
||||
id=373317
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Chameleon Colossus
|
||||
id=373321
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Char
|
||||
id=373332
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Cruel Ultimatum
|
||||
id=373318
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Dark Ritual
|
||||
id=373329
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Fact or Fiction
|
||||
id=373325
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Fyndhorn Elves
|
||||
id=373320
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Gilded Lotus
|
||||
id=373335
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Green Sun's Zenith
|
||||
id=373333
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Hymn to Tourach
|
||||
id=373324
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Impulse
|
||||
id=373330
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Ink-Eyes, Servant of Oni
|
||||
id=373327
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Jace, the Mind Sculptor
|
||||
id=373316
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Kessig Wolf Run
|
||||
id=373323
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Swords to Plowshares
|
||||
id=373334
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Tangle Wire
|
||||
id=373322
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Thran Dynamo
|
||||
id=373331
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Venser, Shaper Savant
|
||||
id=373326
|
||||
rarity=M
|
||||
[/card]
|
||||
[card]
|
||||
primitive=Wall of Blossoms
|
||||
id=373319
|
||||
rarity=M
|
||||
[/card]
|
||||
@@ -17432,7 +17432,7 @@ toughness=4
|
||||
[card]
|
||||
name=Cranial Plating
|
||||
auto=foreach(artifact|mybattlefield) 1/0
|
||||
auto={B}{B}:attach
|
||||
auto={B}{B}:name(attach) retarget target(creature|mybattlefield)
|
||||
auto={1}:equip
|
||||
text=Equipped creature gets +1/+0 for each artifact you control. -- {B}{B}: Attach Cranial Plating to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
|
||||
mana={2}
|
||||
@@ -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}
|
||||
@@ -23286,7 +23293,7 @@ type=Sorcery
|
||||
[/card]
|
||||
[card]
|
||||
name=Dragon Hatchling
|
||||
auto={1}{R}:1/0
|
||||
auto={R}:1/0
|
||||
abilities=flying
|
||||
text=Flying -- {R}: Dragon Hatchling gets +1/+0 until end of turn.
|
||||
mana={1}{R}
|
||||
@@ -39826,7 +39833,7 @@ name=Healer's Headdress
|
||||
auto={1}:equip
|
||||
auto=0/2
|
||||
auto=teach(creature) {T}:prevent:1 target(creature,player)
|
||||
auto={W}{W}:attach
|
||||
auto={W}{W}:name(attach) retarget target(creature|mybattlefield)
|
||||
text=Equipped creature gets +0/+2 and has "{T}: Prevent the next 1 damage that would be dealt to target creature or player this turn." -- {W}{W}: Attach Healer's Headdress to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
|
||||
mana={2}
|
||||
type=Artifact
|
||||
@@ -41596,7 +41603,7 @@ toughness=2
|
||||
name=Horned Helm
|
||||
auto=1/1
|
||||
auto=trample
|
||||
auto={G}{G}:attach
|
||||
auto={G}{G}:name(attach) retarget target(creature|mybattlefield)
|
||||
auto={1}:equip
|
||||
text=Equipped creature gets +1/+1 and has trample. -- {G}{G}: Attach Horned Helm to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
|
||||
mana={2}
|
||||
@@ -54155,6 +54162,18 @@ power=2
|
||||
toughness=2
|
||||
[/card]
|
||||
[card]
|
||||
name=Master of Waves
|
||||
abilities=protection from red
|
||||
auto=lord(Elemental|mybattlefield) 1/1
|
||||
auto=token(Elemental,Creature Elemental,1/0)*type:manaU
|
||||
text=Protection from red. -- Elemental creatures you control get +1/+1. -- When Master of Waves enters the battlefield, put a number of 1/0 blue Elemental creature tokens onto the battlefield equal to your devotion to blue. (Each {U} in the mana costs of permanents you control counts toward your devotion to blue.)
|
||||
mana={3}{U}
|
||||
type=Creature
|
||||
subtype=Merfolk Wizard
|
||||
power=2
|
||||
toughness=1
|
||||
[/card]
|
||||
[card]
|
||||
name=Master Splicer
|
||||
auto=token(Golem,Artifact Creature Golem,3/3)
|
||||
auto=lord(golem|mybattlefield) 1/1
|
||||
@@ -59971,7 +59990,7 @@ toughness=2
|
||||
[card]
|
||||
name=Neurok Stealthsuit
|
||||
auto=teach(creature) shroud
|
||||
auto={U}{U}:attach
|
||||
auto={U}{U}:name(attach) retarget target(creature|mybattlefield)
|
||||
auto={1}:equip
|
||||
text=Equipped creature has shroud. (It can't be the target of spells or abilities.) -- {U}{U}: Attach Neurok Stealthsuit to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
|
||||
mana={2}
|
||||
@@ -83425,7 +83444,7 @@ toughness=3
|
||||
[card]
|
||||
name=Sparring Collar
|
||||
auto=first strike
|
||||
auto={R}{R}:attach
|
||||
auto={R}{R}:name(attach) retarget target(creature|mybattlefield)
|
||||
auto={1}:equip
|
||||
text=Equipped creature has first strike. -- {R}{R}: Attach Sparring Collar to target creature you control. -- Equip {1} ({1}: Attach to target creature you control. Equip only as a sorcery.)
|
||||
mana={2}
|
||||
@@ -83704,7 +83723,7 @@ type=Instant
|
||||
[card]
|
||||
name=Spell Rupture
|
||||
target=*|stack
|
||||
auto=if cantargetcard(*|opponentstack) then transforms((,newability[pay[[{value:power:highest:creature:opponentbattlefield}]] name(pay {value} mana) donothing?fizzle])) forever else transforms((,newability[pay[[{value:power:highest:creature:mybattlefield.}]] name(pay {value} mana) donothing?fizzle])) forever
|
||||
auto=if cantargetcard(*|opponentstack) then transforms((,newability[pay[[{value:power:highest:creature:opponentbattlefield}]] name(pay {value} mana) donothing?fizzle])) forever else transforms((,newability[pay[[{value:power:highest:creature:mybattlefield}]] name(pay {value} mana) donothing?fizzle])) forever
|
||||
text=Counter target spell unless its controller pays {X}, where X is the greatest power among creatures you control.
|
||||
mana={1}{U}
|
||||
type=Instant
|
||||
@@ -88480,7 +88499,7 @@ toughness=3
|
||||
[card]
|
||||
name=Syncopate
|
||||
target=*|stack
|
||||
auto=transforms((,newability[pay[[{x}]] name(pay {value} mana) donothing?fizzleto(exile)])) forever
|
||||
auto=transforms((,newability[pay[[{value:storedx}]] name(pay {value} mana) donothing?fizzleto(exile)])) forever
|
||||
text=Counter target spell unless its controller pays {X}. If that spell is countered this way, exile it instead of putting it into its owner's graveyard.
|
||||
mana={X}{U}
|
||||
type=Instant
|
||||
@@ -103456,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.
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -226,6 +226,7 @@ colossus_of_sardia1.txt
|
||||
colossus_of_sardia2.txt
|
||||
composite_golem.txt
|
||||
conservator.txt
|
||||
consign_to_dream.txt
|
||||
Contagion_Clasp.txt
|
||||
control_magic.txt
|
||||
control_magic2.txt
|
||||
@@ -238,7 +239,7 @@ counterspell.txt
|
||||
counterspell2.txt
|
||||
counterspell3.txt
|
||||
counterspell4.txt
|
||||
counter_unless_pay.txt
|
||||
counter_unless_pay_x.txt
|
||||
Covetous_Dragon_ASLONGAS_3.txt
|
||||
Covetous_Dragon_ASLONGAS_4.txt
|
||||
cranial_plating.txt
|
||||
@@ -248,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
|
||||
@@ -614,6 +616,8 @@ souls_attendant_i489.txt
|
||||
soul's grace_POWERLIFEGAIN.txt
|
||||
spark_elemental.txt
|
||||
spectral_shield_CANTBETARGETOF.txt
|
||||
spell_rupture.txt
|
||||
spell_rupture_2.txt
|
||||
sphinx_summoner.txt
|
||||
spirit_link.txt
|
||||
spirit_link_i173.txt
|
||||
|
||||
25
projects/mtg/bin/Res/test/consign_to_dream.txt
Normal file
25
projects/mtg/bin/Res/test/consign_to_dream.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
# Test TargetChooser based on negation of two colors
|
||||
# Grizzly bear should be put on top of library
|
||||
|
||||
# name=Consign to Dream
|
||||
# Return target permanent to its owner's hand.
|
||||
# If that permanent is red or green, put it on top of its owner's library
|
||||
|
||||
[INIT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
hand:Consign to Dream
|
||||
manapool:{2}{U}
|
||||
inplay:grizzly bears
|
||||
[PLAYER2]
|
||||
[DO]
|
||||
Consign to Dream
|
||||
grizzly bears
|
||||
endinterruption
|
||||
[ASSERT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
graveyard:Consign to Dream
|
||||
library:grizzly bears
|
||||
[PLAYER2]
|
||||
[END]
|
||||
27
projects/mtg/bin/Res/test/counter_unless_pay_x.txt
Normal file
27
projects/mtg/bin/Res/test/counter_unless_pay_x.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
#Testing Counter unless pay {X} mechanic
|
||||
#P1 casts Think Twice with {5} left in his mana pool and P2 counters with Syncopate using X = 3. P1 chooses to pay {3} and Think Twice resolves with {2} left in his mana pool.
|
||||
[INIT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
hand:think twice
|
||||
manapool:{1}{U}{5}
|
||||
library:counterspell
|
||||
[PLAYER2]
|
||||
hand:syncopate
|
||||
manapool:{3}{U}
|
||||
[DO]
|
||||
think twice
|
||||
no
|
||||
yes
|
||||
syncopate
|
||||
think twice
|
||||
choice 0
|
||||
[ASSERT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
hand:counterspell
|
||||
graveyard:think twice
|
||||
manapool:{2}
|
||||
[PLAYER2]
|
||||
graveyard:syncopate
|
||||
[END]
|
||||
26
projects/mtg/bin/Res/test/crucible_of_worlds.txt
Normal file
26
projects/mtg/bin/Res/test/crucible_of_worlds.txt
Normal 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]
|
||||
29
projects/mtg/bin/Res/test/spell_rupture.txt
Normal file
29
projects/mtg/bin/Res/test/spell_rupture.txt
Normal file
@@ -0,0 +1,29 @@
|
||||
# Testing spell rupture (expression: "pay[[{value:WParsedInt}]]")
|
||||
# counter opponent spell
|
||||
[INIT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
hand:bad moon
|
||||
manapool:{1}{B}{4}
|
||||
inplay:raging goblin
|
||||
[PLAYER2]
|
||||
inplay:grizzly bears
|
||||
hand:spell rupture
|
||||
manapool:{1}{U}
|
||||
[DO]
|
||||
bad moon
|
||||
no
|
||||
yes
|
||||
spell rupture
|
||||
bad moon
|
||||
choice 0
|
||||
[ASSERT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
manapool:{2}
|
||||
inplay:raging goblin,bad moon
|
||||
[PLAYER2]
|
||||
graveyard:spell rupture
|
||||
manapool:{0}
|
||||
inplay:grizzly bears
|
||||
[END]
|
||||
25
projects/mtg/bin/Res/test/spell_rupture_2.txt
Normal file
25
projects/mtg/bin/Res/test/spell_rupture_2.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
# Testing spell rupture (expression: "pay[[{value:WParsedInt}]]")
|
||||
# counter own spell
|
||||
[INIT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
hand:bad moon,spell rupture
|
||||
manapool:{1}{B}{1}{U}{4}
|
||||
inplay:raging goblin
|
||||
[PLAYER2]
|
||||
inplay:grizzly bears
|
||||
[DO]
|
||||
bad moon
|
||||
yes
|
||||
spell rupture
|
||||
bad moon
|
||||
choice 0
|
||||
[ASSERT]
|
||||
firstmain
|
||||
[PLAYER1]
|
||||
graveyard:spell rupture
|
||||
manapool:{3}
|
||||
inplay:raging goblin,bad moon
|
||||
[PLAYER2]
|
||||
inplay:grizzly bears
|
||||
[END]
|
||||
@@ -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)
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
#include <JGui.h>
|
||||
#include "MTGDefinitions.h"
|
||||
|
||||
#define INACTIVE 0
|
||||
#define ACTION_REQUESTED 1
|
||||
#define ACTIVE 2
|
||||
|
||||
class MTGCardInstance;
|
||||
class ManaCost;
|
||||
class Targetable;
|
||||
@@ -22,31 +18,33 @@ class WEvent;
|
||||
class ActionElement: public JGuiObject
|
||||
{
|
||||
protected:
|
||||
int activeState;
|
||||
enum Activity{
|
||||
Inactive,
|
||||
ActionRequested,
|
||||
Active
|
||||
};
|
||||
|
||||
Activity activity;
|
||||
TargetChooser * tc;
|
||||
public:
|
||||
GamePhase currentPhase;
|
||||
GamePhase newPhase;
|
||||
int modal;
|
||||
int waitingForAnswer;
|
||||
int getActivity();
|
||||
virtual void Update(float){};
|
||||
virtual void Render(){};
|
||||
virtual void Update(float){}
|
||||
virtual void Render(){}
|
||||
virtual int testDestroy()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int destroy()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual bool CheckUserInput(JButton)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
;
|
||||
ActionElement(int id);
|
||||
ActionElement(const ActionElement& copyFromMe);
|
||||
TargetChooser * getActionTc(){return tc;}
|
||||
@@ -62,27 +60,22 @@ public:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int stillInUse(MTGCardInstance *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int receiveEvent(WEvent *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual int reactToClick(MTGCardInstance *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
virtual const char * getMenuText()
|
||||
virtual const string getMenuText()
|
||||
{
|
||||
return "Ability";
|
||||
}
|
||||
;
|
||||
virtual ActionElement * clone() const = 0;
|
||||
|
||||
};
|
||||
|
||||
@@ -41,16 +41,9 @@ class DamageStack;
|
||||
class ManaCost;
|
||||
class TargetChooser;
|
||||
|
||||
|
||||
#define ACTIONSTACK_STANDARD 0
|
||||
#define ACTIONSTACK_TARGET 1
|
||||
|
||||
class Interruptible: public PlayGuiObject, public Targetable
|
||||
{
|
||||
public:
|
||||
//TODO : remove these when they are back in PlayGuiObject
|
||||
float x, y;
|
||||
|
||||
int state, display;
|
||||
MTGCardInstance * source;
|
||||
virtual void Entering()
|
||||
@@ -186,6 +179,11 @@ public:
|
||||
class ActionStack :public GuiLayer
|
||||
{
|
||||
public:
|
||||
enum ActionStackMode{
|
||||
ACTIONSTACK_STANDARD = 0,
|
||||
ACTIONSTACK_TARGET = 1
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NOT_DECIDED = 0,
|
||||
@@ -207,7 +205,7 @@ protected:
|
||||
InterruptDecision interruptDecision[2];
|
||||
float timer;
|
||||
int currentState;
|
||||
int mode;
|
||||
ActionStackMode mode;
|
||||
int checked;
|
||||
ATutorialMessage* currentTutorial;
|
||||
int interruptBtnXOffset, noBtnXOffset, noToAllBtnXOffset, interruptDialogWidth;
|
||||
|
||||
@@ -873,8 +873,8 @@ public:
|
||||
return 0;
|
||||
if (!tc->canTarget(e->damage->target)) return 0;
|
||||
if (fromTc && !fromTc->canTarget(e->damage->source)) return 0;
|
||||
if (type == 1 && e->damage->typeOfDamage != DAMAGE_COMBAT) return 0;
|
||||
if (type == 2 && e->damage->typeOfDamage == DAMAGE_COMBAT) return 0;
|
||||
if (type == 1 && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT) return 0;
|
||||
if (type == 2 && e->damage->typeOfDamage == Damage::DAMAGE_COMBAT) return 0;
|
||||
e->damage->target->thatmuch = e->damage->damage;
|
||||
e->damage->source->thatmuch = e->damage->damage;
|
||||
this->source->thatmuch = e->damage->damage;
|
||||
@@ -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)
|
||||
@@ -2577,7 +2578,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
a->source = (MTGCardInstance *) d;
|
||||
}
|
||||
@@ -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))
|
||||
@@ -2725,7 +2727,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
if (d->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
if (d->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
a->source = (MTGCardInstance *) d;
|
||||
}
|
||||
@@ -2794,113 +2796,24 @@ public:
|
||||
//equipment
|
||||
class AEquip: public TargetAbility
|
||||
{
|
||||
public:
|
||||
private:
|
||||
bool isAttach;
|
||||
vector<MTGAbility *> currentAbilities;
|
||||
AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost = NULL, int restrictions =
|
||||
ActivatedAbility::AS_SORCERY) :
|
||||
TargetAbility(observer, _id, _source, NULL, _cost, restrictions)
|
||||
{
|
||||
aType = MTGAbility::STANDARD_EQUIP;
|
||||
}
|
||||
|
||||
public:
|
||||
AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost = NULL,
|
||||
int restrictions = ActivatedAbility::AS_SORCERY);
|
||||
|
||||
int unequip()
|
||||
{
|
||||
if (source->target)
|
||||
{
|
||||
source->target->equipment -= 1;
|
||||
source->parentCards.clear();
|
||||
for(unsigned int w = 0;w < source->target->childrenCards.size();w++)
|
||||
{
|
||||
MTGCardInstance * child = source->target->childrenCards[w];
|
||||
if(child == source)
|
||||
source->target->childrenCards.erase(source->target->childrenCards.begin() + w);
|
||||
}
|
||||
}
|
||||
source->target = NULL;
|
||||
for (size_t i = 0; i < currentAbilities.size(); ++i)
|
||||
{
|
||||
MTGAbility * a = currentAbilities[i];
|
||||
if (dynamic_cast<AEquip *> (a) || dynamic_cast<ATeach *> (a) || dynamic_cast<AAConnect *> (a) || (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot))
|
||||
{
|
||||
SAFE_DELETE(a);
|
||||
continue;
|
||||
}
|
||||
game->removeObserver(currentAbilities[i]);
|
||||
}
|
||||
currentAbilities.clear();
|
||||
return 1;
|
||||
}
|
||||
int unequip();
|
||||
int equip(MTGCardInstance * equipped);
|
||||
|
||||
int equip(MTGCardInstance * equipped)
|
||||
{
|
||||
source->target = equipped;
|
||||
source->target->equipment += 1;
|
||||
source->parentCards.push_back(equipped);
|
||||
source->target->childrenCards.push_back((MTGCardInstance*)source);
|
||||
AbilityFactory af(game);
|
||||
af.getAbilities(¤tAbilities, NULL, source);
|
||||
for (size_t i = 0; i < currentAbilities.size(); ++i)
|
||||
{
|
||||
MTGAbility * a = currentAbilities[i];
|
||||
if (dynamic_cast<AEquip *> (a)) continue;
|
||||
if (dynamic_cast<ATeach *> (a)) continue;
|
||||
if (dynamic_cast<AAConnect *> (a)) continue;
|
||||
if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)
|
||||
{
|
||||
a->forceDestroy = 1;
|
||||
continue;
|
||||
}
|
||||
if (dynamic_cast<AACopier *> (af.getCoreAbility(a)))
|
||||
{
|
||||
a->forceDestroy = 1;
|
||||
continue;
|
||||
}
|
||||
//we generally dont want to pass oneShot tokencreators to the cards
|
||||
//we equip...
|
||||
a->addToGame();
|
||||
}
|
||||
return 1;
|
||||
int resolve();
|
||||
const string getMenuText();
|
||||
|
||||
}
|
||||
|
||||
int resolve()
|
||||
{
|
||||
MTGCardInstance * mTarget = tc->getNextCardTarget();
|
||||
if (!mTarget) return 0;
|
||||
if (mTarget == source) return 0;
|
||||
unequip();
|
||||
equip(mTarget);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
{
|
||||
return "Equip";
|
||||
}
|
||||
|
||||
int testDestroy()
|
||||
{
|
||||
if (source->target && !game->isInPlay(source->target))
|
||||
unequip();
|
||||
if(!game->connectRule)
|
||||
{
|
||||
if (source->target && TargetAbility::tc && !TargetAbility::tc->canTarget((Targetable *)source->target,true))
|
||||
unequip();
|
||||
}
|
||||
return TargetAbility::testDestroy();
|
||||
}
|
||||
|
||||
int destroy()
|
||||
{
|
||||
unequip();
|
||||
return TargetAbility::destroy();
|
||||
}
|
||||
|
||||
AEquip * clone() const
|
||||
{
|
||||
return NEW AEquip(*this);
|
||||
}
|
||||
int testDestroy();
|
||||
int destroy();
|
||||
|
||||
AEquip * clone() const;
|
||||
};
|
||||
|
||||
class ATokenCreator: public ActivatedAbility
|
||||
@@ -3123,7 +3036,7 @@ public:
|
||||
card->setAttacker(1);
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
sprintf(menuText, "Create %s", name.c_str());
|
||||
return menuText;
|
||||
@@ -3224,7 +3137,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
if(name.size())
|
||||
return name.c_str();
|
||||
@@ -3397,7 +3310,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -3609,7 +3522,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return ability->getMenuText();
|
||||
}
|
||||
@@ -3632,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;
|
||||
|
||||
};
|
||||
@@ -3646,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();
|
||||
|
||||
@@ -3663,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;
|
||||
|
||||
@@ -3677,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();
|
||||
};
|
||||
@@ -3691,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();
|
||||
};
|
||||
@@ -3719,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;
|
||||
};
|
||||
|
||||
@@ -3729,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;
|
||||
};
|
||||
|
||||
@@ -3750,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*/
|
||||
@@ -3760,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*/
|
||||
@@ -3771,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*/
|
||||
@@ -3783,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*/
|
||||
@@ -3848,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();
|
||||
};
|
||||
@@ -3901,7 +3814,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Swap power and toughness";
|
||||
}
|
||||
@@ -3917,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;
|
||||
|
||||
};
|
||||
@@ -4153,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();
|
||||
};
|
||||
@@ -4176,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();
|
||||
};
|
||||
@@ -4192,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();
|
||||
};
|
||||
@@ -4251,7 +4164,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "Exalted";
|
||||
}
|
||||
@@ -4269,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();
|
||||
};
|
||||
@@ -4346,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();
|
||||
};
|
||||
@@ -4363,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();
|
||||
};
|
||||
@@ -4385,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();
|
||||
@@ -4411,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();
|
||||
};
|
||||
@@ -4425,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();
|
||||
|
||||
@@ -4445,7 +4358,7 @@ public:
|
||||
void Update(float dt);
|
||||
void resolveBlink();
|
||||
int resolve();
|
||||
const char * getMenuText();
|
||||
const string getMenuText();
|
||||
ABlink * clone() const;
|
||||
~ABlink();
|
||||
private:
|
||||
@@ -4463,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();
|
||||
|
||||
@@ -5369,7 +5282,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * getMenuText()
|
||||
const string getMenuText()
|
||||
{
|
||||
return "phase alter";
|
||||
}
|
||||
@@ -5388,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;
|
||||
};
|
||||
|
||||
@@ -5401,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;
|
||||
};
|
||||
|
||||
@@ -5412,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;
|
||||
};
|
||||
|
||||
@@ -5425,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();
|
||||
|
||||
@@ -5440,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;
|
||||
};
|
||||
|
||||
@@ -5612,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();
|
||||
@@ -5638,7 +5551,7 @@ public:
|
||||
{
|
||||
WEventDamage * e = (WEventDamage *) event;
|
||||
Damage * d = e->damage;
|
||||
if (combatonly && e->damage->typeOfDamage != DAMAGE_COMBAT)
|
||||
if (combatonly && e->damage->typeOfDamage != Damage::DAMAGE_COMBAT)
|
||||
return 0;
|
||||
MTGCardInstance * card = d->source;
|
||||
if (d->damage > 0 && card && (card == source || card == source->target))
|
||||
@@ -5729,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();
|
||||
};
|
||||
@@ -5742,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();
|
||||
};
|
||||
@@ -5756,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();
|
||||
|
||||
@@ -5773,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();
|
||||
};
|
||||
@@ -5781,11 +5694,10 @@ class GenericFlipACoin: public ActivatedAbility
|
||||
{
|
||||
public:
|
||||
string baseAbility;
|
||||
bool chooseColor;
|
||||
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();
|
||||
|
||||
@@ -5804,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();
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _CACHE_ENGINE_H_
|
||||
#define _CACHE_ENGINE_H_
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "Threading.h"
|
||||
@@ -208,3 +211,5 @@ public:
|
||||
|
||||
CardRetrieverBase* CacheEngine::sInstance = NULL;
|
||||
bool CacheEngine::sIsThreaded = false;
|
||||
|
||||
#endif //_CACHE_ENGINE_H_
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
#include "MTGGameZones.h"
|
||||
#include "Counters.h"
|
||||
|
||||
#define CD_OR 1
|
||||
#define CD_AND 2
|
||||
|
||||
enum ENUM_COMPARISON_MODES
|
||||
{
|
||||
COMPARISON_NONE = 0, // Needs to remain 0 for quick if(comparison_mode) checks
|
||||
@@ -31,7 +28,12 @@ class CardDescriptor: public MTGCardInstance
|
||||
MTGCardInstance * match_not(MTGCardInstance * card);
|
||||
bool valueInRange(int comparisonMode, int value, int criterion);
|
||||
public:
|
||||
int mode;
|
||||
enum Operator{
|
||||
CD_OR = 1,
|
||||
CD_AND = 2
|
||||
};
|
||||
|
||||
Operator mode;
|
||||
int powerComparisonMode;
|
||||
int toughnessComparisonMode;
|
||||
int manacostComparisonMode;
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef _CARDEFFECT_H_
|
||||
#define _CARDEFFECT_H_
|
||||
|
||||
#include <JGE.h>
|
||||
#include "Effects.h"
|
||||
|
||||
struct CardGui;
|
||||
|
||||
class CardEffect: public Effect
|
||||
{
|
||||
public:
|
||||
CardEffect(CardGui* target);
|
||||
~CardEffect();
|
||||
private:
|
||||
CardGui* target;
|
||||
|
||||
public:
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
#endif // _CARDEFFECT_H_
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
45
projects/mtg/include/CarouselDeckView.h
Normal file
45
projects/mtg/include/CarouselDeckView.h
Normal 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_
|
||||
@@ -11,17 +11,15 @@ class JGuiObject;
|
||||
class MTGCardInstance;
|
||||
class GameObserver;
|
||||
|
||||
#define DAMAGEABLE_MTGCARDINSTANCE 0
|
||||
#define DAMAGEABLE_PLAYER 1
|
||||
|
||||
#define DAMAGE_ALL_TYPES 0
|
||||
#define DAMAGE_COMBAT 1
|
||||
#define DAMAGE_OTHER 2
|
||||
|
||||
class Damageable:public Targetable
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
enum DamageableType{
|
||||
DAMAGEABLE_MTGCARDINSTANCE = 0,
|
||||
DAMAGEABLE_PLAYER
|
||||
};
|
||||
|
||||
int life;
|
||||
int handsize;
|
||||
int poisonCount;
|
||||
@@ -29,12 +27,14 @@ public:
|
||||
int preventable;
|
||||
int thatmuch;
|
||||
int lifeLostThisTurn;
|
||||
int type_as_damageable;
|
||||
DamageableType type_as_damageable;
|
||||
Damageable(GameObserver* observer, int _life)
|
||||
: Targetable(observer)
|
||||
{life=_life;lifeLostThisTurn = 0;};
|
||||
int getLife(){return life;};
|
||||
virtual int dealDamage(int damage){life-=damage;return life;};
|
||||
: Targetable(observer), life(_life), handsize(0),
|
||||
poisonCount(0), damageCount(0), preventable(0), thatmuch(0),
|
||||
lifeLostThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{}
|
||||
int getLife(){return life;}
|
||||
virtual int dealDamage(int damage){life-=damage;return life;}
|
||||
virtual int afterDamage(){return 0;}
|
||||
virtual int poisoned(){return 0;}
|
||||
virtual int prevented(){return 0;}
|
||||
@@ -47,17 +47,23 @@ public:
|
||||
|
||||
class Damage: public Interruptible
|
||||
{
|
||||
protected:
|
||||
void init(MTGCardInstance * source, Damageable * target, int damage, int typeOfDamage);
|
||||
public:
|
||||
enum DamageType{
|
||||
DAMAGE_ALL_TYPES = 0,
|
||||
DAMAGE_COMBAT,
|
||||
DAMAGE_OTHER
|
||||
};
|
||||
|
||||
Damageable * target;
|
||||
int typeOfDamage;
|
||||
DamageType typeOfDamage;
|
||||
int damage;
|
||||
void Render();
|
||||
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target);
|
||||
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target, int damage, int typeOfDamage = DAMAGE_OTHER);
|
||||
Damage(GameObserver* observer, MTGCardInstance* source, Damageable * target, int damage, DamageType typeOfDamage = DAMAGE_OTHER);
|
||||
int resolve();
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
protected:
|
||||
void init(MTGCardInstance * source, Damageable * target, int damage, DamageType typeOfDamage);
|
||||
};
|
||||
|
||||
class DamageStack : public GuiLayer, public Interruptible
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#ifndef _DECK_EDITOR_MENU_H
|
||||
#define _DECK_EDITOR_MENU_H
|
||||
#pragma once
|
||||
#include "DeckMenu.h"
|
||||
#include "DeckDataWrapper.h"
|
||||
@@ -15,7 +17,8 @@ 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();
|
||||
};
|
||||
#endif //_DECK_EDITOR_MENU_H
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _DECK_MANAGER_H
|
||||
#define _DECK_MANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -43,3 +46,5 @@ public:
|
||||
~DeckManager();
|
||||
|
||||
};
|
||||
|
||||
#endif //_DECK_MANAGER_H
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -77,9 +77,7 @@ public:
|
||||
}
|
||||
|
||||
// Setters
|
||||
void setDescription( const string description ) { mDescription = description; };
|
||||
|
||||
;
|
||||
void setDescription( const string& description ) { mDescription = description; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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;
|
||||
|
||||
241
projects/mtg/include/DeckView.h
Normal file
241
projects/mtg/include/DeckView.h
Normal 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_
|
||||
245
projects/mtg/include/Easing.h
Normal file
245
projects/mtg/include/Easing.h
Normal 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_
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "MTGCard.h"
|
||||
#include "MTGGameZones.h"
|
||||
|
||||
#include "CardEffect.h"
|
||||
#ifdef NETWORK_SUPPORT
|
||||
#include "JNetwork.h"
|
||||
#endif //NETWORK_SUPPORT
|
||||
@@ -49,7 +48,6 @@ public:
|
||||
|
||||
GameType gameType;
|
||||
Rules * rules;
|
||||
CardEffect *effect;
|
||||
#ifdef NETWORK_SUPPORT
|
||||
string mServerAddress;
|
||||
JNetwork* mpNetwork;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
154
projects/mtg/include/GridDeckView.h
Normal file
154
projects/mtg/include/GridDeckView.h
Normal 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
|
||||
@@ -1,10 +1,14 @@
|
||||
#ifndef _GUI_MANA_H
|
||||
#define _GUI_MANA_H
|
||||
|
||||
#include "string.h"
|
||||
#include <vector>
|
||||
#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
|
||||
{
|
||||
@@ -51,3 +55,5 @@ public:
|
||||
virtual int receiveEventPlus(WEvent * e);
|
||||
virtual int receiveEventMinus(WEvent * e);
|
||||
};
|
||||
|
||||
#endif //_GUI_MANA_H
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef _MTGPACCK_H_
|
||||
#ifndef _MTGPACK_H_
|
||||
#define _MTGPACK_H_
|
||||
|
||||
class ShopBooster;
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#ifndef _OSD_H_
|
||||
#define _OSD_H_
|
||||
|
||||
class OSDLayer: public PlayGuiObjectController
|
||||
{
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(JButton key);
|
||||
virtual void Render();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef OBJECTANALYTICS_H
|
||||
#define OBJECTANALYTICS_H
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define TRACK_OBJECT_USAGE
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <JGui.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "GameApp.h"
|
||||
#include "GameStateOptions.h"
|
||||
#include "WFilter.h"
|
||||
#include "WDataSrc.h"
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,9 +29,10 @@ protected:
|
||||
TargetChooser * tcTarget;
|
||||
int damage;
|
||||
bool oneShot;
|
||||
int typeOfDamage;
|
||||
Damage::DamageType typeOfDamage;
|
||||
public:
|
||||
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true, int typeOfDamage = DAMAGE_ALL_TYPES);
|
||||
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL, TargetChooser *_tcTarget = NULL,
|
||||
int _damage = -1, bool _oneShot = true, Damage::DamageType typeOfDamage = Damage::DAMAGE_ALL_TYPES);
|
||||
WEvent * replace(WEvent *e);
|
||||
~REDamagePrevention();
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef _STYLE_MANAGER_H_
|
||||
#define _STYLE_MANAGER_H_
|
||||
|
||||
class WStyle
|
||||
{
|
||||
public:
|
||||
@@ -34,3 +37,5 @@ protected:
|
||||
string activeStyle;
|
||||
map<string, WStyle*> styles;
|
||||
};
|
||||
|
||||
#endif //_STYLE_MANAGER_H_
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "MTGDeck.h"
|
||||
|
||||
#ifndef _WFILTER_H_
|
||||
#define _WFILTER_H_
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
class hgeDistortionMesh;
|
||||
class GameStateOptions;
|
||||
class SimpleMenu;
|
||||
|
||||
/**
|
||||
@defgroup WGui Basic Gui
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _DEBUG_H_
|
||||
#define _DEBUG_H_
|
||||
|
||||
#if ((defined WIN32) || (defined WP8)) && (!defined QT_CONFIG)
|
||||
#if ((defined WIN32) || (defined WP8))
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -74,8 +74,7 @@ AIHint::AIHint(string _line)
|
||||
|
||||
if(action.find( "combo ") != string::npos)
|
||||
{
|
||||
string Combo = "";
|
||||
Combo = action.c_str() + 6;
|
||||
string Combo = action.c_str() + 6;
|
||||
combos.push_back(Combo);
|
||||
}
|
||||
|
||||
@@ -307,14 +306,13 @@ bool AIHints::canWeCombo(GameObserver* observer,MTGCardInstance * card,AIPlayerB
|
||||
TargetChooserFactory tfc(observer);
|
||||
TargetChooser * hintTc = NULL;
|
||||
bool gotCombo = false;
|
||||
int comboPartsHold = 0;
|
||||
int comboPartsUntil = 0;
|
||||
int comboPartsRestriction = 0;
|
||||
|
||||
for(unsigned int i = 0; i < hints.size();i++)
|
||||
{
|
||||
comboPartsHold = 0;
|
||||
comboPartsUntil = 0;
|
||||
comboPartsRestriction = 0;
|
||||
int comboPartsHold = 0;
|
||||
int comboPartsUntil = 0;
|
||||
int comboPartsRestriction = 0;
|
||||
|
||||
if(gotCombo)
|
||||
return gotCombo;//because more then one might be possible at any time.
|
||||
if (hints[i]->hold.size())
|
||||
|
||||
@@ -90,13 +90,12 @@ int AIMomirPlayer::computeActions()
|
||||
}
|
||||
else if (p == this && observer->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
|
||||
{ //standard actions
|
||||
CardDescriptor cd;
|
||||
MTGCardInstance * card = NULL;
|
||||
|
||||
switch (currentGamePhase)
|
||||
{
|
||||
case MTG_PHASE_FIRSTMAIN:
|
||||
{
|
||||
CardDescriptor cd;
|
||||
ManaCost * potentialMana = getPotentialMana();
|
||||
int converted = potentialMana->getConvertedCost();
|
||||
SAFE_DELETE(potentialMana);
|
||||
@@ -106,7 +105,7 @@ int AIMomirPlayer::computeActions()
|
||||
//Attempt to put land into play
|
||||
cd.init();
|
||||
cd.setColor(Constants::MTG_COLOR_LAND);
|
||||
card = cd.match(game->hand);
|
||||
MTGCardInstance *card = cd.match(game->hand);
|
||||
int canPutLandsIntoPlay = game->playRestrictions->canPutIntoZone(card, game->inPlay);
|
||||
if (card && (canPutLandsIntoPlay == PlayRestriction::CAN_PLAY))
|
||||
{
|
||||
@@ -118,15 +117,12 @@ int AIMomirPlayer::computeActions()
|
||||
}
|
||||
momir();
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
case MTG_PHASE_SECONDMAIN:
|
||||
selectAbility();
|
||||
return 1;
|
||||
break;
|
||||
default:
|
||||
return AIPlayerBaka::computeActions();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return AIPlayerBaka::computeActions();
|
||||
|
||||
@@ -97,7 +97,7 @@ int AIAction::clickMultiAct(vector<Targetable*>& actionTargets)
|
||||
ite = actionTargets.erase(ite);
|
||||
continue;
|
||||
}
|
||||
ite++;
|
||||
++ite;
|
||||
}
|
||||
|
||||
//shuffle to make it less predictable, otherwise ai will always seem to target from right to left. making it very obvious.
|
||||
@@ -167,7 +167,7 @@ int AIPlayer::clickMultiTarget(TargetChooser * tc, vector<Targetable*>& potentia
|
||||
ite = potentialTargets.erase(ite);
|
||||
continue;
|
||||
}
|
||||
ite++;
|
||||
++ite;
|
||||
}
|
||||
|
||||
randomGenerator.random_shuffle(potentialTargets.begin(), potentialTargets.end());
|
||||
|
||||
@@ -134,10 +134,9 @@ int OrderedAIAction::getEfficiency()
|
||||
if (!target)
|
||||
break;
|
||||
|
||||
bool NeedPreventing;
|
||||
NeedPreventing = false;
|
||||
if (currentPhase == MTG_PHASE_COMBATBLOCKERS)
|
||||
{
|
||||
bool NeedPreventing = false;
|
||||
MTGCardInstance * nextOpponent = target->getNextOpponent();
|
||||
if(!nextOpponent)
|
||||
break;
|
||||
@@ -152,12 +151,10 @@ int OrderedAIAction::getEfficiency()
|
||||
//small bonus added for the poor 1/1s, if we can save them, we will unless something else took precidence.
|
||||
//note is the target is being blocked or blocking a creature with wither or deathtouch, it is not even considered for preventing as it is a waste.
|
||||
//if its combat blockers, it is being blocked or blocking, and has less prevents the the amount of damage it will be taking, the effeincy is increased slightly and totalled by the danger rank multiplier for final result.
|
||||
int calculateAfterDamage = 0;
|
||||
int damages = 0;
|
||||
if((target->defenser || target->blockers.size()) && target->controller() == p)
|
||||
{
|
||||
damages = nextOpponent->power;
|
||||
calculateAfterDamage = int(target->toughness - damages);
|
||||
int damages = nextOpponent->power;
|
||||
int calculateAfterDamage = target->toughness - damages;
|
||||
if((calculateAfterDamage + target->preventable) > 0)
|
||||
{
|
||||
efficiency = 0;
|
||||
@@ -588,8 +585,7 @@ int OrderedAIAction::getEfficiency()
|
||||
efficiency = 80;
|
||||
if(atc->name.length() && atc->sabilities.length() && atc->types.size() && p->game->inPlay->findByName(atc->name))
|
||||
{
|
||||
list<int>::iterator it;
|
||||
for (it = atc->types.begin(); it != atc->types.end(); it++)
|
||||
for (list<int>::const_iterator it = atc->types.begin(); it != atc->types.end(); ++it)
|
||||
{
|
||||
if(*it == Subtypes::TYPE_LEGENDARY)//ai please stop killing voja!!! :P
|
||||
efficiency = 0;
|
||||
@@ -978,11 +974,10 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
||||
}
|
||||
}
|
||||
ManaCostHybrid * hybridCost;
|
||||
int hyb;
|
||||
hyb = 0;
|
||||
hybridCost = cost->getHybridCost(0);
|
||||
if(hybridCost)
|
||||
{
|
||||
int hyb = 0;
|
||||
while ((hybridCost = cost->getHybridCost(hyb)) != NULL)
|
||||
{
|
||||
//here we try to find one of the colors in the hybrid cost, it is done 1 at a time unfortunately
|
||||
@@ -1046,7 +1041,6 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
||||
{
|
||||
|
||||
ManaCost * withKickerCost= NEW ManaCost(cost->getKicker());
|
||||
int canKick = 0;
|
||||
vector<MTGAbility*>kickerPayment;
|
||||
bool keepLooking = true;
|
||||
while(keepLooking)
|
||||
@@ -1061,7 +1055,6 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
||||
payments.push_back(kickerPayment[w]);
|
||||
}
|
||||
}
|
||||
canKick += 1;
|
||||
keepLooking = cost->getKicker()->isMulti;
|
||||
}
|
||||
else
|
||||
@@ -1297,12 +1290,10 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
|
||||
|
||||
TargetChooser * AIPlayerBaka::GetComboTc( GameObserver * observer,TargetChooser * tc)
|
||||
{
|
||||
TargetChooser * gathertc = NULL;
|
||||
TargetChooserFactory tcf(observer);
|
||||
map<string, string>::iterator it = comboHint->cardTargets.begin();
|
||||
for(map<string, string>::iterator it = comboHint->cardTargets.begin();it != comboHint->cardTargets.end();it++)
|
||||
for(map<string, string>::iterator it = comboHint->cardTargets.begin();it != comboHint->cardTargets.end();++it)
|
||||
{
|
||||
gathertc = tcf.createTargetChooser(it->first.c_str(),tc->source);
|
||||
TargetChooser *gathertc = tcf.createTargetChooser(it->first.c_str(),tc->source);
|
||||
gathertc->setAllZones();
|
||||
if(gathertc->canTarget(tc->source))
|
||||
{
|
||||
@@ -1402,7 +1393,6 @@ int AIPlayerBaka::selectAbility()
|
||||
MTGCardInstance * card = game->inPlay->cards[j];
|
||||
if(a->getCost() && !a->isReactingToClick(card, totalPotentialMana))//for performance reason only look for specific mana if the payment couldnt be made with potential.
|
||||
{
|
||||
abilityPayment = vector<MTGAbility*>();
|
||||
abilityPayment = canPayMana(card,a->getCost());
|
||||
}
|
||||
if (a->isReactingToClick(card, totalPotentialMana) || abilityPayment.size())
|
||||
@@ -1410,10 +1400,9 @@ int AIPlayerBaka::selectAbility()
|
||||
if(a->getCost() && a->getCost()->hasX() && totalPotentialMana->getConvertedCost() < a->getCost()->getConvertedCost()+1)
|
||||
continue;
|
||||
//don't even bother to play an ability with {x} if you can't even afford x=1.
|
||||
ManaCost * fullPayment = NULL;
|
||||
if (abilityPayment.size())
|
||||
{
|
||||
fullPayment = NEW ManaCost();
|
||||
ManaCost *fullPayment = NEW ManaCost();
|
||||
for(int ch = 0; ch < int(abilityPayment.size());ch++)
|
||||
{
|
||||
AManaProducer * ampp = dynamic_cast<AManaProducer*> (abilityPayment[ch]);
|
||||
@@ -1525,7 +1514,7 @@ int AIPlayerBaka::chooseTarget(TargetChooser * _tc, Player * forceTarget,MTGCard
|
||||
}
|
||||
//Make sure we own the decision to choose the targets
|
||||
assert(tc->Owner == observer->currentlyActing());
|
||||
if (tc && tc->Owner != observer->currentlyActing())
|
||||
if (tc->Owner != observer->currentlyActing())
|
||||
{
|
||||
observer->currentActionPlayer = tc->Owner;
|
||||
//this is a hack, but if we hit this condition we are locked in a infinate loop
|
||||
@@ -1905,12 +1894,11 @@ MTGCardInstance * AIPlayerBaka::activateCombo()
|
||||
{
|
||||
if(!comboHint)
|
||||
return NULL;
|
||||
TargetChooser * hintTc = NULL;
|
||||
TargetChooserFactory tfc(observer);
|
||||
ManaCost * totalCost = ManaCost::parseManaCost(comboHint->manaNeeded);
|
||||
for(unsigned int k = 0;k < comboHint->casting.size(); k++)
|
||||
{
|
||||
hintTc = tfc.createTargetChooser(comboHint->casting[k],nextCardToPlay);
|
||||
TargetChooser *hintTc = tfc.createTargetChooser(comboHint->casting[k],nextCardToPlay);
|
||||
int combohand = game->hand->cards.size();
|
||||
for(int j = 0; j < combohand;j++)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ AIStats::AIStats(Player * _player, char * _filename)
|
||||
AIStats::~AIStats()
|
||||
{
|
||||
list<AIStat *>::iterator it;
|
||||
for (it = stats.begin(); it != stats.end(); it++)
|
||||
for (it = stats.begin(); it != stats.end(); ++it)
|
||||
{
|
||||
AIStat * stat = *it;
|
||||
delete stat;
|
||||
@@ -47,7 +47,7 @@ void AIStats::updateStatsCard(MTGCardInstance * cardInstance, Damage * damage, f
|
||||
{
|
||||
stat->value += static_cast<int>(multiplier * STATS_PLAYER_MULTIPLIER * damage->damage);
|
||||
}
|
||||
else if (damage->target->type_as_damageable == DAMAGEABLE_MTGCARDINSTANCE)
|
||||
else if (damage->target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
MTGCardInstance * target = (MTGCardInstance *) damage->target;
|
||||
if (target->controller() == player && !target->isInPlay(player->getObserver()))
|
||||
@@ -115,7 +115,7 @@ bool AIStats::isInTop(MTGCardInstance * card, unsigned int max, bool tooSmallCou
|
||||
MTGCard * source = card->model;
|
||||
int id = source->getMTGId();
|
||||
list<AIStat *>::iterator it;
|
||||
for (it = stats.begin(); it != stats.end(); it++)
|
||||
for (it = stats.begin(); it != stats.end(); ++it)
|
||||
{
|
||||
if (n >= max)
|
||||
return false;
|
||||
@@ -135,7 +135,7 @@ AIStat * AIStats::find(MTGCard * source)
|
||||
{
|
||||
int id = source->getMTGId();
|
||||
list<AIStat *>::iterator it;
|
||||
for (it = stats.begin(); it != stats.end(); it++)
|
||||
for (it = stats.begin(); it != stats.end(); ++it)
|
||||
{
|
||||
AIStat * stat = *it;
|
||||
if (stat->source == id)
|
||||
@@ -174,7 +174,7 @@ void AIStats::save()
|
||||
{
|
||||
char writer[128];
|
||||
list<AIStat *>::iterator it;
|
||||
for (it = stats.begin(); it != stats.end(); it++)
|
||||
for (it = stats.begin(); it != stats.end(); ++it)
|
||||
{
|
||||
AIStat * stat = *it;
|
||||
if (stat->value > 0)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
ActionElement::ActionElement(int id) :
|
||||
JGuiObject(id)
|
||||
{
|
||||
activeState = INACTIVE;
|
||||
activity = Inactive;
|
||||
modal = 0;
|
||||
waitingForAnswer = 0;
|
||||
currentPhase = MTG_PHASE_INVALID;
|
||||
@@ -18,7 +18,7 @@ ActionElement::ActionElement(int id) :
|
||||
|
||||
ActionElement::ActionElement(const ActionElement& a): JGuiObject(a)
|
||||
{
|
||||
activeState = a.activeState;
|
||||
activity = a.activity;
|
||||
tc = a.tc ? a.tc->clone() : NULL;
|
||||
currentPhase = a.currentPhase;
|
||||
newPhase = a.newPhase;
|
||||
@@ -31,12 +31,6 @@ ActionElement::~ActionElement()
|
||||
SAFE_DELETE(tc);
|
||||
}
|
||||
|
||||
int ActionElement::getActivity()
|
||||
{
|
||||
|
||||
return activeState;
|
||||
}
|
||||
|
||||
int ActionElement::isReactingToTargetClick(Targetable * object)
|
||||
{
|
||||
if (MTGCardInstance * cObject = dynamic_cast<MTGCardInstance *>(object))
|
||||
|
||||
@@ -165,8 +165,6 @@ void ActionLayer::Update(float dt)
|
||||
if (cantCancel)
|
||||
{
|
||||
ActionElement * ae = isWaitingForAnswer();
|
||||
int countTargets = 0;
|
||||
int maxTargets = 0;
|
||||
if(ae && ae->getActionTc())
|
||||
{
|
||||
if (!ae->getActionTc()->validTargetsExist())
|
||||
@@ -175,8 +173,8 @@ void ActionLayer::Update(float dt)
|
||||
cancelCurrentAction();
|
||||
return;
|
||||
}
|
||||
countTargets = ae->getActionTc()->countValidTargets();
|
||||
maxTargets = ae->getActionTc()->maxtargets;
|
||||
int countTargets = ae->getActionTc()->countValidTargets();
|
||||
int maxTargets = ae->getActionTc()->maxtargets;
|
||||
if (countTargets < maxTargets)
|
||||
{
|
||||
/*
|
||||
@@ -266,7 +264,7 @@ int ActionLayer::receiveEventPlus(WEvent * event)
|
||||
ActionElement * currentAction = (ActionElement *) mObjects[i];
|
||||
result += currentAction->receiveEvent(event);
|
||||
}
|
||||
return 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
int ActionLayer::isReactingToTargetClick(Targetable * card)
|
||||
@@ -440,10 +438,9 @@ void ActionLayer::setCustomMenuObject(Targetable * object, bool must,vector<MTGA
|
||||
if(abilities.size())
|
||||
{
|
||||
abilitiesMenu->isMultipleChoice = true;
|
||||
ActionElement * currentAction = NULL;
|
||||
for(int w = 0; w < int(abilities.size());w++)
|
||||
{
|
||||
currentAction = (ActionElement*)abilities[w];
|
||||
ActionElement* currentAction = (ActionElement*)abilities[w];
|
||||
currentActionCard = (MTGCardInstance*)abilities[0]->target;
|
||||
abilitiesMenu->Add(mObjects.size()-1, currentAction->getMenuText(),"",false);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user