diff --git a/.travis.yml b/.travis.yml index 1ff1dbd72..2b6cf9e36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,2 +1,9 @@ language: cpp -script: "qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug && make -j 8 && ./wagic" +before_install: + - export PSPDEV="$TRAVIS_BUILD_DIR/opt/pspsdk" + - export PSPSDK="$PSPDEV/psp/sdk" + - export PATH="$PATH:$PSPDEV/bin:$PSPSDK/bin" +install: + - 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 +script: "./travis-script.sh" diff --git a/JGE/include/JTypes.h b/JGE/include/JTypes.h index 3f479fb1c..c8f3f6b60 100644 --- a/JGE/include/JTypes.h +++ b/JGE/include/JTypes.h @@ -128,11 +128,11 @@ 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)) +#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 +#define TEXTURE_FORMAT 0 +#endif //PSP #ifndef CONSOLE_CONFIG @@ -150,7 +150,7 @@ typedef uint32_t u32; #include #endif #else -# include +#include #endif #if (defined FORCE_GLES) @@ -164,105 +164,104 @@ typedef uint32_t u32; #endif #if defined (PSP) - - #ifndef ABGR8888 - #define ABGR8888 - #endif +#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 - #define MAKE_COLOR(a, c) (a << 24 | c) - #define MASK_ALPHA 0xFF000000 // masks for accessing individual pixels - #define MASK_BLUE 0x00FF0000 - #define MASK_GREEN 0x0000FF00 - #define MASK_RED 0x000000FF +#if defined (ABGR8888) +#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 +#define MAKE_COLOR(a, c) (a << 24 | c) +#define MASK_ALPHA 0xFF000000 // masks for accessing individual pixels +#define MASK_BLUE 0x00FF0000 +#define MASK_GREEN 0x0000FF00 +#define MASK_RED 0x000000FF - #define PIXEL_SIZE 4 - #define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_8888 +#define PIXEL_SIZE 4 +#define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_8888 - #define BUFFER_FORMAT GU_PSM_8888 - #define TEXTURE_FORMAT GU_PSM_8888 - #define TEXTURE_COLOR_FORMAT GU_COLOR_8888 +#define BUFFER_FORMAT GU_PSM_8888 +#define TEXTURE_FORMAT GU_PSM_8888 +#define TEXTURE_COLOR_FORMAT GU_COLOR_8888 - #elif defined (ABGR5551) +#elif defined (ABGR5551) - #ifndef ARGB - #define ARGB(a, r, g, b) ((r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10) | ((a >> 7) << 15)) - #endif - #define MAKE_COLOR(a, c) (((a>>7)<<15) | c) - #define MASK_ALPHA 0x8000 - #define MASK_BLUE 0x7C00 - #define MASK_GREEN 0x03E0 - #define MASK_RED 0x001F - #define PIXEL_TYPE u16 - #define PIXEL_SIZE 2 - #define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_5551 +#ifndef ARGB +#define ARGB(a, r, g, b) ((r >> 3) | ((g >> 3) << 5) | ((b >> 3) << 10) | ((a >> 7) << 15)) +#endif +#define MAKE_COLOR(a, c) (((a>>7)<<15) | c) +#define MASK_ALPHA 0x8000 +#define MASK_BLUE 0x7C00 +#define MASK_GREEN 0x03E0 +#define MASK_RED 0x001F +#define PIXEL_TYPE u16 +#define PIXEL_SIZE 2 +#define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_5551 - #define BUFFER_FORMAT GU_PSM_8888 - #define TEXTURE_FORMAT GU_PSM_5551 - #define TEXTURE_COLOR_FORMAT GU_COLOR_5551 +#define BUFFER_FORMAT GU_PSM_8888 +#define TEXTURE_FORMAT GU_PSM_5551 +#define TEXTURE_COLOR_FORMAT GU_COLOR_5551 - #elif defined (ABGR4444) - #ifndef ARGB - #define ARGB(a, r, g, b) ((r >> 4) | ((g >> 4) << 4) | ((b >> 4) << 8) | ((a >> 4) << 12)) - #endif - #define MAKE_COLOR(a, c) (((a>>4)<<12) | c) - #define MASK_ALPHA 0xF000 - #define MASK_BLUE 0x0F00 - #define MASK_GREEN 0x00F0 - #define MASK_RED 0x000F - #define PIXEL_TYPE u16 - #define PIXEL_SIZE 2 - #define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_4444 +#elif defined (ABGR4444) +#ifndef ARGB +#define ARGB(a, r, g, b) ((r >> 4) | ((g >> 4) << 4) | ((b >> 4) << 8) | ((a >> 4) << 12)) +#endif +#define MAKE_COLOR(a, c) (((a>>4)<<12) | c) +#define MASK_ALPHA 0xF000 +#define MASK_BLUE 0x0F00 +#define MASK_GREEN 0x00F0 +#define MASK_RED 0x000F +#define PIXEL_TYPE u16 +#define PIXEL_SIZE 2 +#define PIXEL_FORMAT PSP_DISPLAY_PIXEL_FORMAT_4444 - #define BUFFER_FORMAT GU_PSM_4444 - #define TEXTURE_FORMAT GU_PSM_4444 - #define TEXTURE_COLOR_FORMAT GU_COLOR_4444 +#define BUFFER_FORMAT GU_PSM_4444 +#define TEXTURE_FORMAT GU_PSM_4444 +#define TEXTURE_COLOR_FORMAT GU_COLOR_4444 - #endif +#endif - #define FRAME_BUFFER_WIDTH 512 - #define FRAME_BUFFER_SIZE FRAME_BUFFER_WIDTH*SCREEN_HEIGHT*PIXEL_SIZE +#define FRAME_BUFFER_WIDTH 512 +#define FRAME_BUFFER_SIZE FRAME_BUFFER_WIDTH*SCREEN_HEIGHT*PIXEL_SIZE - #define SLICE_SIZE_F 64.0f - typedef unsigned int DWORD; +#define SLICE_SIZE_F 64.0f +typedef unsigned int DWORD; - #define BLEND_ZERO 0x1000 - #define BLEND_ONE 0x1002 - #define BLEND_SRC_COLOR GU_SRC_COLOR - #define BLEND_ONE_MINUS_SRC_COLOR GU_ONE_MINUS_SRC_COLOR - #define BLEND_SRC_ALPHA GU_SRC_ALPHA - #define BLEND_ONE_MINUS_SRC_ALPHA GU_ONE_MINUS_SRC_ALPHA - #define BLEND_DST_ALPHA GU_DST_ALPHA - #define BLEND_ONE_MINUS_DST_ALPHA GU_ONE_MINUS_DST_ALPHA - #define BLEND_DST_COLOR GU_DST_COLOR - #define BLEND_ONE_MINUS_DST_COLOR GU_ONE_MINUS_DST_COLOR - #define BLEND_SRC_ALPHA_SATURATE BLEND_ONE +#define BLEND_ZERO 0x1000 +#define BLEND_ONE 0x1002 +#define BLEND_SRC_COLOR GU_SRC_COLOR +#define BLEND_ONE_MINUS_SRC_COLOR GU_ONE_MINUS_SRC_COLOR +#define BLEND_SRC_ALPHA GU_SRC_ALPHA +#define BLEND_ONE_MINUS_SRC_ALPHA GU_ONE_MINUS_SRC_ALPHA +#define BLEND_DST_ALPHA GU_DST_ALPHA +#define BLEND_ONE_MINUS_DST_ALPHA GU_ONE_MINUS_DST_ALPHA +#define BLEND_DST_COLOR GU_DST_COLOR +#define BLEND_ONE_MINUS_DST_COLOR GU_ONE_MINUS_DST_COLOR +#define BLEND_SRC_ALPHA_SATURATE BLEND_ONE - typedef struct - { - ScePspFVector2 texture; - ScePspFVector3 pos; - } PSPVertex3D; +typedef struct +{ + ScePspFVector2 texture; + ScePspFVector3 pos; +} PSPVertex3D; -#elif !defined(WP8) //non PSP +#elif (!defined WP8) - #define BLEND_ZERO GL_ZERO - #define BLEND_ONE GL_ONE - #define BLEND_SRC_COLOR GL_SRC_COLOR - #define BLEND_ONE_MINUS_SRC_COLOR GL_ONE_MINUS_SRC_COLOR - #define BLEND_SRC_ALPHA GL_SRC_ALPHA - #define BLEND_ONE_MINUS_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA - #define BLEND_DST_ALPHA GL_DST_ALPHA - #define BLEND_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_DST_ALPHA - #define BLEND_DST_COLOR GL_DST_COLOR - #define BLEND_ONE_MINUS_DST_COLOR GL_ONE_MINUS_DST_COLOR - #define BLEND_SRC_ALPHA_SATURATE GL_SRC_ALPHA_SATURATE + +#define BLEND_ZERO GL_ZERO +#define BLEND_ONE GL_ONE +#define BLEND_SRC_COLOR GL_SRC_COLOR +#define BLEND_ONE_MINUS_SRC_COLOR GL_ONE_MINUS_SRC_COLOR +#define BLEND_SRC_ALPHA GL_SRC_ALPHA +#define BLEND_ONE_MINUS_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA +#define BLEND_DST_ALPHA GL_DST_ALPHA +#define BLEND_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_DST_ALPHA +#define BLEND_DST_COLOR GL_DST_COLOR +#define BLEND_ONE_MINUS_DST_COLOR GL_ONE_MINUS_DST_COLOR +#define BLEND_SRC_ALPHA_SATURATE GL_SRC_ALPHA_SATURATE #define GU_PSM_8888 0 #define GU_PSM_5551 0 @@ -287,7 +286,7 @@ typedef uint32_t u32; #define GU_PSM_4444 0 #define GU_PSM_5650 0 #endif -#else +#else // CONSOLE_CONFIG typedef uint32_t GLuint; typedef float GLfloat; #endif //CONSOLE_CONFIG diff --git a/JGE/include/corewrapper.h b/JGE/include/corewrapper.h index 5cd0c199a..6fe3d7b62 100644 --- a/JGE/include/corewrapper.h +++ b/JGE/include/corewrapper.h @@ -67,6 +67,9 @@ public: void registerDefaultBindings(); static WagicCore* getInstance() { return s_instance; }; char *GetName(){ return m_launcher->GetName();}; +#ifdef QT_CONFIG + QTime startTime; +#endif private: void doAndEnqueue(JButton action) { @@ -75,6 +78,7 @@ private: } private: + friend int JGEGetTime(); static WagicCore* s_instance; JGE* m_engine; JApp* m_app; diff --git a/JGE/src/JFileSystem.cpp b/JGE/src/JFileSystem.cpp index 6423b83d4..b4bff9009 100644 --- a/JGE/src/JFileSystem.cpp +++ b/JGE/src/JFileSystem.cpp @@ -16,7 +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. */ +#ifndef PSP #include "PrecompiledHeader.h" +#endif //PSP #ifdef WIN32 #pragma warning(disable : 4786) diff --git a/JGE/src/SDLmain.cpp b/JGE/src/SDLmain.cpp index 7b6e1cd71..2dbc9bdd4 100644 --- a/JGE/src/SDLmain.cpp +++ b/JGE/src/SDLmain.cpp @@ -84,7 +84,6 @@ public: /* For easy interfacing with JGE static functions */ bool Running; SDL_Window* window; SDL_Surface* Surf_Display; -// SDL_Rect viewPort; Uint32 lastMouseUpTime; Uint32 lastFingerDownTime; int windowed_w; diff --git a/JGE/src/corewrapper.cpp b/JGE/src/corewrapper.cpp index 38c532e88..2b3435293 100644 --- a/JGE/src/corewrapper.cpp +++ b/JGE/src/corewrapper.cpp @@ -19,8 +19,11 @@ WagicCore* WagicCore::s_instance = 0; WagicCore::WagicCore() : m_engine(0), m_app(0), m_launcher(0), m_active(false) { +#ifdef QT_CONFIG + startTime = QTime::currentTime(); +#endif //QT_CONFIG + s_instance = this; m_lastTickCount = JGEGetTime(); - s_instance = this; } void WagicCore::initApp() @@ -367,7 +370,7 @@ int JGEGetTime() #ifdef SDL_CONFIG return (int)SDL_GetTicks(); #elif defined QT_CONFIG - return QTime::currentTime().elapsed(); + return WagicCore::s_instance->startTime.msecsTo(QTime::currentTime()); #elif defined WP8 return (int)GetTickCount64(); #endif diff --git a/projects/mtg/Android/gen/R.java.d b/projects/mtg/Android/gen/R.java.d deleted file mode 100644 index 3b5cb5410..000000000 --- a/projects/mtg/Android/gen/R.java.d +++ /dev/null @@ -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 \ diff --git a/projects/mtg/Android/gen/net/wagic/app/BuildConfig.java b/projects/mtg/Android/gen/net/wagic/app/BuildConfig.java deleted file mode 100644 index c70b441e9..000000000 --- a/projects/mtg/Android/gen/net/wagic/app/BuildConfig.java +++ /dev/null @@ -1,6 +0,0 @@ -/** Automatically generated file. DO NOT MODIFY */ -package net.wagic.app; - -public final class BuildConfig { - public final static boolean DEBUG = true; -} \ No newline at end of file diff --git a/projects/mtg/Android/gen/net/wagic/app/R.java b/projects/mtg/Android/gen/net/wagic/app/R.java deleted file mode 100644 index ec5e38a14..000000000 --- a/projects/mtg/Android/gen/net/wagic/app/R.java +++ /dev/null @@ -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; - } -} diff --git a/projects/mtg/Android/libs/GoogleAdMobAdsSdk-4.1.1.jar b/projects/mtg/Android/libs/GoogleAdMobAdsSdk-4.1.1.jar deleted file mode 100644 index 7177b0fe4..000000000 Binary files a/projects/mtg/Android/libs/GoogleAdMobAdsSdk-4.1.1.jar and /dev/null differ diff --git a/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java b/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java index 6142ae386..0891808c8 100644 --- a/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java +++ b/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java @@ -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 diff --git a/projects/mtg/Makefile b/projects/mtg/Makefile index 2866c86a1..9485d7d1b 100644 --- a/projects/mtg/Makefile +++ b/projects/mtg/Makefile @@ -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/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 DEPS = $(patsubst objs/%.o, deps/%.d, $(OBJS)) RESULT = $(shell psp-config --psp-prefix 2> Makefile.cache) diff --git a/projects/mtg/bin/Res/sets/V13/_cards.dat b/projects/mtg/bin/Res/sets/V13/_cards.dat new file mode 100644 index 000000000..2ef715464 --- /dev/null +++ b/projects/mtg/bin/Res/sets/V13/_cards.dat @@ -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] diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index bf8f0e792..6d356044e 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -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} @@ -39826,7 +39826,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 +41596,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 +54155,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 +59983,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 +83437,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} diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index e1b65ab04..64e14ee8f 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -2794,113 +2794,24 @@ public: //equipment class AEquip: public TargetAbility { -public: +private: + bool isAttach; vector 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 (a) || dynamic_cast (a) || dynamic_cast (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 (a)) continue; - if (dynamic_cast (a)) continue; - if (dynamic_cast (a)) continue; - if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot) - { - a->forceDestroy = 1; - continue; - } - if (dynamic_cast (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 char * 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 diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 00cf88989..8cbe9742d 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -5291,6 +5291,115 @@ AAConnect * AAConnect::clone() const return NEW AAConnect(*this); } +AEquip::AEquip(GameObserver* observer, int _id, MTGCardInstance * _source, ManaCost * _cost, int restrictions) : + TargetAbility(observer, _id, _source, NULL, _cost, restrictions) +{ + aType = MTGAbility::STANDARD_EQUIP; + isAttach = restrictions != ActivatedAbility::AS_SORCERY; +} + +int AEquip::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 (a) || dynamic_cast (a) || dynamic_cast (a) + || (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot)) + { + SAFE_DELETE(a); + continue; + } + game->removeObserver(currentAbilities[i]); + } + currentAbilities.clear(); + return 1; +} + +int AEquip::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 (a)) continue; + if (dynamic_cast (a)) continue; + if (dynamic_cast (a)) continue; + if (dynamic_cast (af.getCoreAbility(a))) continue; + if (a->aType == MTGAbility::STANDARD_TOKENCREATOR && a->oneShot) + { + a->forceDestroy = 1; + continue; + } + if (dynamic_cast (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 AEquip::resolve() +{ + MTGCardInstance * mTarget = tc->getNextCardTarget(); + if (!mTarget) return 0; + if (mTarget == source) return 0; + unequip(); + equip(mTarget); + return 1; +} + +const char * AEquip::getMenuText() +{ + if (isAttach) + return "Attach"; + else + return "Equip"; +} + +int AEquip::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 AEquip::destroy() +{ + unequip(); + return TargetAbility::destroy(); +} + +AEquip * AEquip::clone() const +{ + return NEW AEquip(*this); +} + // casting a card for free, or casting a copy of a card. AACastCard::AACastCard(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target,bool _restricted,bool _copied,bool asNormal,string _namedCard,string _name,bool _noEvent) : MTGAbility(observer, _id, _source),restricted(_restricted),asCopy(_copied),normal(asNormal),cardNamed(_namedCard),nameThis(_name),noEvent(_noEvent) diff --git a/projects/mtg/src/ExtraCost.cpp b/projects/mtg/src/ExtraCost.cpp index 441122af6..23cba0f51 100644 --- a/projects/mtg/src/ExtraCost.cpp +++ b/projects/mtg/src/ExtraCost.cpp @@ -7,7 +7,11 @@ #include "Player.h" #include "Counters.h" #include "AllAbilities.h" +#ifdef WP8 #include +#else +#include +#endif SUPPORT_OBJECT_ANALYTICS(ExtraCost) @@ -171,7 +175,12 @@ LifeorManaCost::LifeorManaCost(TargetChooser *_tc, string manaType) string buildType ="{"; buildType.append(manaType); buildType.append("}"); - std::unique_ptr cost(ManaCost::parseManaCost(buildType)); +#ifdef WP8 + std::unique_ptr +#else + boost::scoped_ptr +#endif + cost(ManaCost::parseManaCost(buildType)); manaCost.copy(cost.get()); } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 4535f1d13..ff52b934a 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2163,6 +2163,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG return NEW AEquip(observer, id, card); } + // TODO: deprecate this ability in favor of retarget //Equipment (attach) found = s.find("attach"); if (found != string::npos) diff --git a/projects/mtg/wagic-qt.pro b/projects/mtg/wagic-qt.pro index dca2e04e0..0b200776a 100644 --- a/projects/mtg/wagic-qt.pro +++ b/projects/mtg/wagic-qt.pro @@ -324,8 +324,8 @@ SOURCES += \ ../../JGE/src/JParticleSystem.cpp\ ../../JGE/src/JResourceManager.cpp\ ../../JGE/src/JSpline.cpp\ - ../../JGE/src/pc/JSocket.cpp\ ../../JGE/src/pc/JSfx.cpp\ + ../../JGE/src/pc/JSocket.cpp\ ../../JGE/src/JNetwork.cpp\ ../../JGE/src/JSprite.cpp\ ../../JGE/src/Vector2D.cpp\ diff --git a/travis-script.sh b/travis-script.sh new file mode 100755 index 000000000..f01edd15b --- /dev/null +++ b/travis-script.sh @@ -0,0 +1,17 @@ +#!/bin/sh -ex + +# we're building a PSP binary here +cd JGE +make -j 8 +cd .. +cd projects/mtg +mkdir objs +make -j 8 + +# let's try an Intel linux binary +cd ../.. +qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug +make -j 8 + +# and finish by running the testsuite +./wagic